Commit 9cedb3f8 authored by Mark Chao's avatar Mark Chao

Port over fixes

From dev.gitlab repo
parent df3fe91a
...@@ -536,8 +536,8 @@ describe MergeRequest do ...@@ -536,8 +536,8 @@ describe MergeRequest do
it "returns correct value" do it "returns correct value" do
user = create(:user) user = create(:user)
user1 = create(:user) user1 = create(:user)
merge_request.approvers.create(user_id: user.id) create(:approver, target: merge_request, user: user)
merge_request.approvers.create(user_id: user1.id) create(:approver, target: merge_request, user: user1)
merge_request.approvals.create(user_id: user1.id) merge_request.approvals.create(user_id: user1.id)
expect(merge_request.approvers_left).to eq [user] expect(merge_request.approvers_left).to eq [user]
...@@ -550,9 +550,9 @@ describe MergeRequest do ...@@ -550,9 +550,9 @@ describe MergeRequest do
group = create(:group) group = create(:group)
group.add_developer(user2) group.add_developer(user2)
merge_request.approver_groups.create(group: group) create(:approver_group, target: merge_request, group: group)
merge_request.approvers.create(user_id: user.id) create(:approver, target: merge_request, user: user)
merge_request.approvers.create(user_id: user1.id) create(:approver, target: merge_request, user: user1)
merge_request.approvals.create(user_id: user1.id) merge_request.approvals.create(user_id: user1.id)
expect(merge_request.approvers_left).to match_array [user, user2] expect(merge_request.approvers_left).to match_array [user, user2]
......
...@@ -543,6 +543,7 @@ describe EE::NotificationService, :mailer do ...@@ -543,6 +543,7 @@ describe EE::NotificationService, :mailer do
before do before do
merge_request.target_project.update(approvals_before_merge: 1) merge_request.target_project.update(approvals_before_merge: 1)
project_approvers.each { |approver| create(:approver, user: approver, target: merge_request.target_project) } project_approvers.each { |approver| create(:approver, user: approver, target: merge_request.target_project) }
reset_delivered_emails!
end end
it 'emails the approvers' do it 'emails the approvers' do
...@@ -563,6 +564,7 @@ describe EE::NotificationService, :mailer do ...@@ -563,6 +564,7 @@ describe EE::NotificationService, :mailer do
before do before do
mr_approvers.each { |approver| create(:approver, user: approver, target: merge_request) } mr_approvers.each { |approver| create(:approver, user: approver, target: merge_request) }
reset_delivered_emails!
end end
it 'emails the MR approvers' do it 'emails the MR approvers' do
......
...@@ -124,6 +124,11 @@ describe MergeRequests::UpdateService, :mailer do ...@@ -124,6 +124,11 @@ describe MergeRequests::UpdateService, :mailer do
before do before do
stub_feature_flags(approval_rule: false) stub_feature_flags(approval_rule: false)
project.add_developer(existing_approver)
project.add_developer(removed_approver)
project.add_developer(new_approver)
perform_enqueued_jobs do perform_enqueued_jobs do
update_merge_request(approver_ids: [existing_approver, removed_approver].map(&:id).join(',')) update_merge_request(approver_ids: [existing_approver, removed_approver].map(&:id).join(','))
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment