diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-11-19 12:06:16 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-11-19 12:06:16 +0300 |
commit | 34b3567c97ecc0f317adae04e10e4d7d8c8830db (patch) | |
tree | 2612572041a8a6121ce9098cabf8724e67a96ea2 /spec/requests | |
parent | 3209c1a49c14cab93eb347bfca59bace30879440 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/requests')
-rw-r--r-- | spec/requests/api/merge_requests_spec.rb | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/spec/requests/api/merge_requests_spec.rb b/spec/requests/api/merge_requests_spec.rb index c96c80b6998..e5ad1a6378e 100644 --- a/spec/requests/api/merge_requests_spec.rb +++ b/spec/requests/api/merge_requests_spec.rb @@ -1567,6 +1567,18 @@ describe API::MergeRequests do expect(response).to have_gitlab_http_status(200) end + it 'does not merge if merge_when_pipeline_succeeds is passed and the pipeline has failed' do + create(:ci_pipeline, + :failed, + sha: merge_request.diff_head_sha, + merge_requests_as_head_pipeline: [merge_request]) + + put api("/projects/#{project.id}/merge_requests/#{merge_request.iid}/merge", user), params: { merge_when_pipeline_succeeds: true } + + expect(response).to have_gitlab_http_status(405) + expect(merge_request.reload.state).to eq('opened') + end + it "enables merge when pipeline succeeds if the pipeline is active" do allow_any_instance_of(MergeRequest).to receive_messages(head_pipeline: pipeline, actual_head_pipeline: pipeline) allow(pipeline).to receive(:active?).and_return(true) |