summaryrefslogtreecommitdiff
path: root/spec/services
diff options
context:
space:
mode:
authorGrzegorz Bizon <grzesiek.bizon@gmail.com>2017-09-26 15:01:16 +0200
committerGrzegorz Bizon <grzesiek.bizon@gmail.com>2017-09-26 15:01:16 +0200
commit057a8b709346a89e2ccdfe6e9b352ce5f93e71c7 (patch)
tree3720ffcd0368ea7b0da308bb7acdc43d95952923 /spec/services
parent835bdcb88e3eff70b33d27b6ca42e7d1970eac35 (diff)
downloadgitlab-ce-057a8b709346a89e2ccdfe6e9b352ce5f93e71c7.tar.gz
Add test for head pipeline assignment when skipped
Closes gitlab-org/gitlab-ce#34415
Diffstat (limited to 'spec/services')
-rw-r--r--spec/services/ci/create_pipeline_service_spec.rb20
1 files changed, 20 insertions, 0 deletions
diff --git a/spec/services/ci/create_pipeline_service_spec.rb b/spec/services/ci/create_pipeline_service_spec.rb
index 6ee75b8fc23..eb6e683cc23 100644
--- a/spec/services/ci/create_pipeline_service_spec.rb
+++ b/spec/services/ci/create_pipeline_service_spec.rb
@@ -133,6 +133,26 @@ describe Ci::CreatePipelineService do
expect(merge_request.reload.head_pipeline).to eq head_pipeline
end
end
+
+ context 'when pipeline has been skipped' do
+ before do
+ allow_any_instance_of(Ci::Pipeline)
+ .to receive(:git_commit_message)
+ .and_return('some commit [ci skip]')
+ end
+
+ it 'updates merge request head pipeline' do
+ merge_request = create(:merge_request, source_branch: 'master',
+ target_branch: 'feature',
+ source_project: project)
+
+ head_pipeline = execute_service
+
+ expect(head_pipeline).to be_skipped
+ expect(head_pipeline).to be_persisted
+ expect(merge_request.reload.head_pipeline).to eq head_pipeline
+ end
+ end
end
context 'auto-cancel enabled' do