Skip to content

Commit

Permalink
Fix syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
nanego committed Sep 20, 2023
1 parent b953b6d commit c1e36d5
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 14 deletions.
2 changes: 1 addition & 1 deletion app/controllers/organizations/memberships_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ def update_group_non_member_roles
end

add_member_edition_to_journal(membership, previous_role_ids, membership.roles.ids) if Redmine::Plugin.installed?(:redmine_admin_activity)

respond_to do |format|
format.html { redirect_to settings_project_path(@project, :tab => 'members') }
format.js { render :update }
Expand Down
25 changes: 12 additions & 13 deletions spec/controllers/memberships_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,21 +33,21 @@
if Redmine::Plugin.installed?(:redmine_admin_activity)
journal_detail_count_after_delation = JournalDetail.count

expect(journal_detail_count_after_delation) .to eq(journal_detail_count_before_delation + 4)
expect(journal_detail_count_after_delation).to eq(journal_detail_count_before_delation + 4)

last_journals_for_delection_of_member = JournalDetail.last(4)
last_journals_for_delection_of_member = JournalDetail.last(4)
user1_journal = last_journals_for_delection_of_member[0]
user2_journal = last_journals_for_delection_of_member[2]

user1_name = JSON.parse(user1_journal.old_value)["name"]
user2_name = JSON.parse(user2_journal.old_value)["name"]

pro_key_value = Redmine::Plugin.installed?(:redmine_limited_visibility) ? 'member_roles_and_functions' : 'member_with_roles'
pro_key_value = Redmine::Plugin.installed?(:redmine_limited_visibility) ? 'member_roles_and_functions' : 'member_with_roles'

expect(user1_journal).to have_attributes(:prop_key => pro_key_value)
expect(user2_journal).to have_attributes(:prop_key => pro_key_value)
expect(user1_name).to eq(user1.name) .or eq(user2.name)
expect(user2_name).to eq(user1.name) .or eq(user2.name)
expect(user1_name).to eq(user1.name).or eq(user2.name)
expect(user2_name).to eq(user1.name).or eq(user2.name)
end
end

Expand All @@ -70,13 +70,12 @@
if Redmine::Plugin.installed?(:redmine_admin_activity)
journal_detail_count_after_delation = JournalDetail.count

expect(journal_detail_count_after_delation) .to eq(journal_detail_count_before_delation + 2)
expect(journal_detail_count_after_delation).to eq(journal_detail_count_before_delation + 2)


last_journal_for_delection_of_member = JournalDetail.last(2)[0]
last_journal_for_delection_of_member = JournalDetail.last(2)[0]
user_name = JSON.parse(last_journal_for_delection_of_member.old_value)["name"]

pro_key_value = Redmine::Plugin.installed?(:redmine_limited_visibility) ? 'member_roles_and_functions' : 'member_with_roles'
pro_key_value = Redmine::Plugin.installed?(:redmine_limited_visibility) ? 'member_roles_and_functions' : 'member_with_roles'

expect(last_journal_for_delection_of_member).to have_attributes(:prop_key => pro_key_value)
expect(user_name).to eq(user2.name)
Expand All @@ -86,16 +85,16 @@
if Redmine::Plugin.installed?(:redmine_admin_activity)
it "add logs on JournalDetail when change non_member roles" do
expect do
patch :update_group_non_member_roles ,:params => {
patch :update_group_non_member_roles, :params => {
:project_id => 5,
:membership => {:role_ids => ["2", "3"]},
:membership => { :role_ids => ["2", "3"] },
:group_id => 12
}
}
end.to change { JournalDetail.count }.by (1)

expect(JournalDetail.last.property).to eq("members")
expect(JournalDetail.last.prop_key).to eq("member_roles_and_functions")
end
end
end
end
end

0 comments on commit c1e36d5

Please sign in to comment.