summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShinya Maeda <shinya@gitlab.com>2019-03-28 18:07:27 +0700
committerShinya Maeda <shinya@gitlab.com>2019-04-04 13:42:02 +0700
commit1c8e99be48551b8b04791166886d2b2ac86d83d3 (patch)
tree118cc04d1ebba94c1797557b7c19516dae1f7540
parent74ace2a445a44a13bd22c1907b8ec55b1772d403 (diff)
downloadgitlab-ce-1c8e99be48551b8b04791166886d2b2ac86d83d3.tar.gz
Ignore merge if the status of the merge request pipeline is staleignore-merge-when-merge-pipelines-is-stale-ce
Merge request pipeline is meant for ensuring target branch's pipeline green. We should not let maintainers merge a merge request if the head pipeline of the merge request doesn't fulfill the criteria.
-rw-r--r--spec/requests/api/merge_requests_spec.rb7
1 files changed, 6 insertions, 1 deletions
diff --git a/spec/requests/api/merge_requests_spec.rb b/spec/requests/api/merge_requests_spec.rb
index 4259fda7f04..73d4072b9d1 100644
--- a/spec/requests/api/merge_requests_spec.rb
+++ b/spec/requests/api/merge_requests_spec.rb
@@ -1353,7 +1353,12 @@ describe API::MergeRequests do
end
it 'returns 405 if the build failed for a merge request that requires success' do
- allow_any_instance_of(MergeRequest).to receive(:mergeable_ci_state?).and_return(false)
+ project.update!(only_allow_merge_if_pipeline_succeeds: true)
+
+ 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)