diff options
author | Shinya Maeda <shinya@gitlab.com> | 2019-08-28 14:51:26 +0700 |
---|---|---|
committer | Shinya Maeda <shinya@gitlab.com> | 2019-09-03 13:30:53 +0700 |
commit | 8c21610c79d2737c9cd728964f499d793e6a1279 (patch) | |
tree | 82af1d1bed4f1a522658b3dfb7c0bc8a766e88cd /spec/presenters | |
parent | 991143eb1f1bb5cda1f709ad44fdc021aa12b75d (diff) | |
download | gitlab-ce-8c21610c79d2737c9cd728964f499d793e6a1279.tar.gz |
Add pipeline.type key to PipelineEntityadd-pipeline-type-key-in-pipeline-entity
This commit adds pipeline.type key to PipelineEntity.
This key will be used in MR widget in the next iteration.
Diffstat (limited to 'spec/presenters')
-rw-r--r-- | spec/presenters/ci/pipeline_presenter_spec.rb | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/spec/presenters/ci/pipeline_presenter_spec.rb b/spec/presenters/ci/pipeline_presenter_spec.rb index cda07a0ae09..7e8bbedcf6d 100644 --- a/spec/presenters/ci/pipeline_presenter_spec.rb +++ b/spec/presenters/ci/pipeline_presenter_spec.rb @@ -77,6 +77,40 @@ describe Ci::PipelinePresenter do end end + describe '#name' do + subject { presenter.name } + + context 'when pipeline is detached merge request pipeline' do + let(:merge_request) { create(:merge_request, :with_detached_merge_request_pipeline) } + let(:pipeline) { merge_request.all_pipelines.last } + + it { is_expected.to eq('Detached merge request pipeline') } + end + + context 'when pipeline is merge request pipeline' do + let(:merge_request) { create(:merge_request, :with_merge_request_pipeline) } + let(:pipeline) { merge_request.all_pipelines.last } + + it { is_expected.to eq('Merged result pipeline') } + end + + context 'when pipeline is merge train pipeline' do + let(:pipeline) { create(:ci_pipeline, project: project) } + + before do + allow(pipeline).to receive(:merge_request_event_type) { :merge_train } + end + + it { is_expected.to eq('Merge train pipeline') } + end + + context 'when pipeline is branch pipeline' do + let(:pipeline) { create(:ci_pipeline, project: project) } + + it { is_expected.to eq('Pipeline') } + end + end + describe '#ref_text' do subject { presenter.ref_text } |