diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-11-06 18:07:37 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-11-06 18:07:37 +0300 |
commit | 31e17bdaabfc530fa0358f4a86800865011a0b23 (patch) | |
tree | 5e8da12639723772316db3db2e6e34edff20334f /spec/requests | |
parent | a661ba47633234590e88004462212e63cc1f658d (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/requests')
-rw-r--r-- | spec/requests/api/merge_request_approvals_spec.rb | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/spec/requests/api/merge_request_approvals_spec.rb b/spec/requests/api/merge_request_approvals_spec.rb index a1d6abec97e..df2b20c62c3 100644 --- a/spec/requests/api/merge_request_approvals_spec.rb +++ b/spec/requests/api/merge_request_approvals_spec.rb @@ -87,6 +87,28 @@ RSpec.describe API::MergeRequestApprovals, feature_category: :source_code_manage expect(response).to have_gitlab_http_status(:created) end + + it 'calls MergeRequests::UpdateReviewerStateService' do + unapprover = create(:user) + + project.add_developer(approver) + project.add_developer(unapprover) + project.add_developer(create(:user)) + + create(:approval, user: approver, merge_request: merge_request) + create(:approval, user: unapprover, merge_request: merge_request) + + expect_next_instance_of( + MergeRequests::UpdateReviewerStateService, + project: project, current_user: unapprover + ) do |service| + expect(service).to receive(:execute).with(merge_request, "unreviewed") + end + + post api("/projects/#{project.id}/merge_requests/#{merge_request.iid}/unapprove", unapprover) + + expect(response).to have_gitlab_http_status(:created) + end end end |