Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShinya Maeda <shinya@gitlab.com>2019-08-28 10:51:26 +0300
committerShinya Maeda <shinya@gitlab.com>2019-09-03 09:30:53 +0300
commit8c21610c79d2737c9cd728964f499d793e6a1279 (patch)
tree82af1d1bed4f1a522658b3dfb7c0bc8a766e88cd /spec/presenters
parent991143eb1f1bb5cda1f709ad44fdc021aa12b75d (diff)
Add pipeline.type key to PipelineEntity
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.rb34
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 }