diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-05-19 10:33:21 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-05-19 10:33:21 +0300 |
commit | 36a59d088eca61b834191dacea009677a96c052f (patch) | |
tree | e4f33972dab5d8ef79e3944a9f403035fceea43f /spec/services/merge_requests/approval_service_spec.rb | |
parent | a1761f15ec2cae7c7f7bbda39a75494add0dfd6f (diff) |
Add latest changes from gitlab-org/gitlab@15-0-stable-eev15.0.0-rc42
Diffstat (limited to 'spec/services/merge_requests/approval_service_spec.rb')
-rw-r--r-- | spec/services/merge_requests/approval_service_spec.rb | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/spec/services/merge_requests/approval_service_spec.rb b/spec/services/merge_requests/approval_service_spec.rb index 9b064da44b8..e500102a00c 100644 --- a/spec/services/merge_requests/approval_service_spec.rb +++ b/spec/services/merge_requests/approval_service_spec.rb @@ -41,6 +41,12 @@ RSpec.describe MergeRequests::ApprovalService do end context 'with valid approval' do + let(:notification_service) { NotificationService.new } + + before do + allow(service).to receive(:notification_service).and_return(notification_service) + end + it 'creates an approval note and marks pending todos as done' do expect(SystemNoteService).to receive(:approve_mr).with(merge_request, user) expect(merge_request.approvals).to receive(:reset) @@ -59,9 +65,16 @@ RSpec.describe MergeRequests::ApprovalService do service.execute(merge_request) end + it 'sends a notification when approving' do + expect(notification_service).to receive_message_chain(:async, :approve_mr) + .with(merge_request, user) + + service.execute(merge_request) + end + it 'removes attention requested state' do expect(MergeRequests::RemoveAttentionRequestedService).to receive(:new) - .with(project: project, current_user: user, merge_request: merge_request) + .with(project: project, current_user: user, merge_request: merge_request, user: user) .and_call_original service.execute(merge_request) |