Skip to content

Commit

Permalink
Fix specs
Browse files Browse the repository at this point in the history
  • Loading branch information
nanego committed Sep 21, 2023
1 parent a5b19cc commit 73ebf3b
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@
end.to change { JournalDetail.count }.by(1)

journal = JournalDetail.last

expect(journal.property).to eq("members_exception")
expect(journal.prop_key).to eq("members_exception_with_roles_functions")
if Redmine::Plugin.installed?(:redmine_limited_visibility)
Expand Down
40 changes: 21 additions & 19 deletions spec/helpers/issues_helper_patch_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -219,25 +219,27 @@
end
end

describe "Exception members property with role and functions in JSON format" do
it "should IssuesHelper#show_detail with no_html should show a new member" do
detail = JournalDetail.new(:property => 'members_exception', :old_value => nil, :value => '{"name":"org2","roles":["Non member"]}', :prop_key => 'members_exception_with_roles')
expect(show_detail(detail, true)).to eq "Exception member org2 has been added with Roles [Non member]"
end

it "should IssuesHelper#show_detail with no_html should show a changing functions only" do
detail = JournalDetail.new(:property => 'members_exception', :old_value => '{"name":"Org A","functions":["function1"]}', :value => '{"name":"Org A","functions":["function1", "function2"]}', :prop_key => 'members_exception_with_functions')
expect(show_detail(detail, true)).to eq "Functional roles of exception member Org A have been changed from [function1] to [function1, function2]"
end

it "should IssuesHelper#show_detail with no_html should show a changing roles only" do
detail = JournalDetail.new(:property => 'members_exception', :old_value => '{"name":"Org A","roles":["Non member"]}', :value => '{"name":"Org A","roles":["Developer", "Manager"]}', :prop_key => 'members_exception_with_roles')
expect(show_detail(detail, true)).to eq "Roles of exception member Org A have been changed from [Non member] to [Developer, Manager]"
end

it "should IssuesHelper#show_detail with no_html should show a changing should show a deleted exception member" do
detail = JournalDetail.new(:property => 'members_exception', :old_value => '{"name":"Org A","roles":["Developer"],"functions":["function1"]}', :value => nil, :prop_key => 'members_exception_with_roles_functions')
expect(show_detail(detail, true)).to eq "Exception member Org A, with roles [Developer] and functions [function1], has been removed"
if Redmine::Plugin.installed?(:redmine_limited_visibility)
describe "Exception members property with role and functions in JSON format" do
it "should IssuesHelper#show_detail with no_html should show a new member" do
detail = JournalDetail.new(:property => 'members_exception', :old_value => nil, :value => '{"name":"org2","roles":["Non member"]}', :prop_key => 'members_exception_with_roles')
expect(show_detail(detail, true)).to eq "Exception member org2 has been added with Roles [Non member]"
end

it "should IssuesHelper#show_detail with no_html should show a changing functions only" do
detail = JournalDetail.new(:property => 'members_exception', :old_value => '{"name":"Org A","functions":["function1"]}', :value => '{"name":"Org A","functions":["function1", "function2"]}', :prop_key => 'members_exception_with_functions')
expect(show_detail(detail, true)).to eq "Functional roles of exception member Org A have been changed from [function1] to [function1, function2]"
end

it "should IssuesHelper#show_detail with no_html should show a changing roles only" do
detail = JournalDetail.new(:property => 'members_exception', :old_value => '{"name":"Org A","roles":["Non member"]}', :value => '{"name":"Org A","roles":["Developer", "Manager"]}', :prop_key => 'members_exception_with_roles')
expect(show_detail(detail, true)).to eq "Roles of exception member Org A have been changed from [Non member] to [Developer, Manager]"
end

it "should IssuesHelper#show_detail with no_html should show a changing should show a deleted exception member" do
detail = JournalDetail.new(:property => 'members_exception', :old_value => '{"name":"Org A","roles":["Developer"],"functions":["function1"]}', :value => nil, :prop_key => 'members_exception_with_roles_functions')
expect(show_detail(detail, true)).to eq "Exception member Org A, with roles [Developer] and functions [function1], has been removed"
end
end
end

Expand Down

0 comments on commit 73ebf3b

Please sign in to comment.