summaryrefslogtreecommitdiff
path: root/spec/models
diff options
context:
space:
mode:
authorKamil Trzciński <ayufan@ayufan.eu>2019-04-05 08:50:53 +0000
committerKamil Trzciński <ayufan@ayufan.eu>2019-04-05 08:50:53 +0000
commit40ac9e331f68e2347a24a3fd78744749f092af09 (patch)
tree8a1fd12b42ba125196c57c94886a2bef0116a656 /spec/models
parent43713d976a93677f3c90f1f1e926bf7d519e02bf (diff)
parentfa73f4ee196b8c9d28c3b0b035acdd71d71dadb3 (diff)
downloadgitlab-ce-40ac9e331f68e2347a24a3fd78744749f092af09.tar.gz
Merge branch 'fix-merge-request-relations-with-pipeline-on-mwps' into 'master'
Fix MWPS doesn't work for merge request pipelines See merge request gitlab-org/gitlab-ce!26906
Diffstat (limited to 'spec/models')
-rw-r--r--spec/models/ci/build_spec.rb25
1 files changed, 22 insertions, 3 deletions
diff --git a/spec/models/ci/build_spec.rb b/spec/models/ci/build_spec.rb
index b9ece6a394a..1352a2de2d7 100644
--- a/spec/models/ci/build_spec.rb
+++ b/spec/models/ci/build_spec.rb
@@ -3216,7 +3216,7 @@ describe Ci::Build do
it 'does not try to create a todo' do
project.add_developer(user)
- expect(service).not_to receive(:commit_status_merge_requests)
+ expect(service).not_to receive(:pipeline_merge_requests)
subject.drop!
end
@@ -3252,7 +3252,23 @@ describe Ci::Build do
end
context 'when build is not configured to be retried' do
- subject { create(:ci_build, :running, project: project, user: user) }
+ subject { create(:ci_build, :running, project: project, user: user, pipeline: pipeline) }
+
+ let(:pipeline) do
+ create(:ci_pipeline,
+ project: project,
+ ref: 'feature',
+ sha: merge_request.diff_head_sha,
+ merge_requests_as_head_pipeline: [merge_request])
+ end
+
+ let(:merge_request) do
+ create(:merge_request, :opened,
+ source_branch: 'feature',
+ source_project: project,
+ target_branch: 'master',
+ target_project: project)
+ end
it 'does not retry build' do
expect(described_class).not_to receive(:retry)
@@ -3271,7 +3287,10 @@ describe Ci::Build do
it 'creates a todo' do
project.add_developer(user)
- expect(service).to receive(:commit_status_merge_requests)
+ expect_next_instance_of(TodoService) do |todo_service|
+ expect(todo_service)
+ .to receive(:merge_request_build_failed).with(merge_request)
+ end
subject.drop!
end