diff options
author | Shinya Maeda <shinya@gitlab.com> | 2018-12-05 15:57:00 +0900 |
---|---|---|
committer | Shinya Maeda <shinya@gitlab.com> | 2018-12-05 15:57:52 +0900 |
commit | e62bfc7817ec024645383a9661fe7e36c13c1e01 (patch) | |
tree | 04227bafe6859ddbf5760ff9d3e1dc5e404fcb10 /spec/workers | |
parent | 23d921989b66881a647afaeafec357f15293790a (diff) | |
download | gitlab-ce-e62bfc7817ec024645383a9661fe7e36c13c1e01.tar.gz |
Merge request pipelines
Diffstat (limited to 'spec/workers')
-rw-r--r-- | spec/workers/update_head_pipeline_for_merge_request_worker_spec.rb | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/spec/workers/update_head_pipeline_for_merge_request_worker_spec.rb b/spec/workers/update_head_pipeline_for_merge_request_worker_spec.rb index 9adde5fc21a..a2bc264b0f6 100644 --- a/spec/workers/update_head_pipeline_for_merge_request_worker_spec.rb +++ b/spec/workers/update_head_pipeline_for_merge_request_worker_spec.rb @@ -34,5 +34,33 @@ describe UpdateHeadPipelineForMergeRequestWorker do expect { subject.perform(merge_request.id) }.not_to change { merge_request.reload.head_pipeline_id } end end + + context 'when a merge request pipeline exists' do + let!(:merge_request_pipeline) do + create(:ci_pipeline, + project: project, + source: :merge_request, + sha: latest_sha, + merge_request: merge_request) + end + + it 'sets the merge request pipeline as the head pipeline' do + expect { subject.perform(merge_request.id) } + .to change { merge_request.reload.head_pipeline_id } + .from(nil).to(merge_request_pipeline.id) + end + + context 'when branch pipeline exists' do + let!(:branch_pipeline) do + create(:ci_pipeline, project: project, source: :push, sha: latest_sha) + end + + it 'prioritizes the merge request pipeline as the head pipeline' do + expect { subject.perform(merge_request.id) } + .to change { merge_request.reload.head_pipeline_id } + .from(nil).to(merge_request_pipeline.id) + end + end + end end end |