diff options
author | Z.J. van de Weg <zegerjan@gitlab.com> | 2016-06-03 16:20:11 +0300 |
---|---|---|
committer | Z.J. van de Weg <zegerjan@gitlab.com> | 2016-06-03 16:20:11 +0300 |
commit | 9d491712cfe33286329524fb39dc5bf8e4c8affd (patch) | |
tree | 0e99ae15e613d5971ba9e7c7ffcdd51e37a2f725 /spec/requests/api/merge_requests_spec.rb | |
parent | fab695461afbc4d03fbbf8cfbf9c5d90760ce752 (diff) | |
parent | ca3c5c295ed653b483fe81c3918ffe60f46666b9 (diff) |
Merge branch 'master' into awardables
Diffstat (limited to 'spec/requests/api/merge_requests_spec.rb')
-rw-r--r-- | spec/requests/api/merge_requests_spec.rb | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/spec/requests/api/merge_requests_spec.rb b/spec/requests/api/merge_requests_spec.rb index 6392bdb1c91..10d22189c8d 100644 --- a/spec/requests/api/merge_requests_spec.rb +++ b/spec/requests/api/merge_requests_spec.rb @@ -427,6 +427,19 @@ describe API::API, api: true do expect(json_response['message']).to eq('401 Unauthorized') end + it "returns 409 if the SHA parameter doesn't match" do + put api("/projects/#{project.id}/merge_requests/#{merge_request.id}/merge", user), sha: merge_request.source_sha.succ + + expect(response.status).to eq(409) + expect(json_response['message']).to start_with('SHA does not match HEAD of source branch') + end + + it "succeeds if the SHA parameter matches" do + put api("/projects/#{project.id}/merge_requests/#{merge_request.id}/merge", user), sha: merge_request.source_sha + + expect(response.status).to eq(200) + end + it "enables merge when build succeeds if the ci is active" do allow_any_instance_of(MergeRequest).to receive(:ci_commit).and_return(ci_commit) allow(ci_commit).to receive(:active?).and_return(true) |