diff options
author | Kamil Trzciński <ayufan@ayufan.eu> | 2017-02-28 13:45:39 +0300 |
---|---|---|
committer | Kamil Trzciński <ayufan@ayufan.eu> | 2017-02-28 13:45:39 +0300 |
commit | cd92c84b5617970ee4b143687120668c6efa4a72 (patch) | |
tree | 6530275060c588cc67ee39280d12be510a688f39 /spec/services/merge_requests | |
parent | 7733f285aca97d444382a59eda0ea3e303539c26 (diff) | |
parent | 2da8bc3de9f8b63bd80a081c7e2880adee3edb71 (diff) |
Merge branch 'only-create-unmergeable-todo-once' into 'master'
Only create unmergeable todos once
Closes #28555
See merge request !9513
Diffstat (limited to 'spec/services/merge_requests')
-rw-r--r-- | spec/services/merge_requests/merge_when_pipeline_succeeds_service_spec.rb | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/spec/services/merge_requests/merge_when_pipeline_succeeds_service_spec.rb b/spec/services/merge_requests/merge_when_pipeline_succeeds_service_spec.rb index f92978a33a3..0ff6e8fda16 100644 --- a/spec/services/merge_requests/merge_when_pipeline_succeeds_service_spec.rb +++ b/spec/services/merge_requests/merge_when_pipeline_succeeds_service_spec.rb @@ -111,6 +111,31 @@ describe MergeRequests::MergeWhenPipelineSucceedsService do service.trigger(unrelated_pipeline) end end + + context 'when the merge request is not mergeable' do + let(:mr_conflict) do + create(:merge_request, merge_when_build_succeeds: true, merge_user: user, + source_branch: 'master', target_branch: 'feature-conflict', + source_project: project, target_project: project) + end + + let(:conflict_pipeline) do + create(:ci_pipeline, project: project, ref: mr_conflict.source_branch, + sha: mr_conflict.diff_head_sha, status: 'success') + end + + it 'does not merge the merge request' do + expect(MergeWorker).not_to receive(:perform_async) + + service.trigger(conflict_pipeline) + end + + it 'creates todos for unmergeability' do + expect_any_instance_of(TodoService).to receive(:merge_request_became_unmergeable).with(mr_conflict) + + service.trigger(conflict_pipeline) + end + end end describe "#cancel" do |