summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorRémy Coutable <remy@rymai.me>2017-10-31 11:58:38 +0000
committerRémy Coutable <remy@rymai.me>2017-10-31 11:58:38 +0000
commit19bf710354b0eb232232c80002c68e59f2cd842b (patch)
treed4cbcd0687ec3b6be26f35b8ef4ef7ba3bbaca98 /spec
parente829d5a08455e608ba5f054ffa65a2af0fe0393c (diff)
parentff1e3a47c4bd15fd5c048c39408361a21057bf30 (diff)
downloadgitlab-ce-19bf710354b0eb232232c80002c68e59f2cd842b.tar.gz
Merge branch '39619-cancel-merge-when-pipeline-succeeds-from-the-api-fails' into 'master'
Fix namespacing for MergeWhenPipelineSucceedsService in MR API Closes #39619 See merge request gitlab-org/gitlab-ce!15088
Diffstat (limited to 'spec')
-rw-r--r--spec/requests/api/merge_requests_spec.rb24
1 files changed, 24 insertions, 0 deletions
diff --git a/spec/requests/api/merge_requests_spec.rb b/spec/requests/api/merge_requests_spec.rb
index 28b1404a4f7..024cfe8b372 100644
--- a/spec/requests/api/merge_requests_spec.rb
+++ b/spec/requests/api/merge_requests_spec.rb
@@ -1061,6 +1061,30 @@ describe API::MergeRequests do
end
end
+ describe 'POST :id/merge_requests/:merge_request_iid/cancel_merge_when_pipeline_succeeds' do
+ before do
+ ::MergeRequests::MergeWhenPipelineSucceedsService.new(merge_request.target_project, user).execute(merge_request)
+ end
+
+ it 'removes the merge_when_pipeline_succeeds status' do
+ post api("/projects/#{project.id}/merge_requests/#{merge_request.iid}/cancel_merge_when_pipeline_succeeds", user)
+
+ expect(response).to have_gitlab_http_status(201)
+ end
+
+ it 'returns 404 if the merge request is not found' do
+ post api("/projects/#{project.id}/merge_requests/123/merge_when_pipeline_succeeds", user)
+
+ expect(response).to have_gitlab_http_status(404)
+ end
+
+ it 'returns 404 if the merge request id is used instead of iid' do
+ post api("/projects/#{project.id}/merge_requests/#{merge_request.id}/merge_when_pipeline_succeeds", user)
+
+ expect(response).to have_gitlab_http_status(404)
+ end
+ end
+
describe 'Time tracking' do
let(:issuable) { merge_request }