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:
Diffstat (limited to 'spec/serializers/pipeline_details_entity_spec.rb')
-rw-r--r--spec/serializers/pipeline_details_entity_spec.rb35
1 files changed, 35 insertions, 0 deletions
diff --git a/spec/serializers/pipeline_details_entity_spec.rb b/spec/serializers/pipeline_details_entity_spec.rb
index d7c40b8e7b9..b180ede51eb 100644
--- a/spec/serializers/pipeline_details_entity_spec.rb
+++ b/spec/serializers/pipeline_details_entity_spec.rb
@@ -138,5 +138,40 @@ describe PipelineDetailsEntity do
expect(subject[:flags][:yaml_errors]).to be false
end
end
+
+ context 'when pipeline is triggered by other pipeline' do
+ let(:pipeline) { create(:ci_empty_pipeline) }
+
+ before do
+ create(:ci_sources_pipeline, pipeline: pipeline)
+ end
+
+ it 'contains an information about depedent pipeline' do
+ expect(subject[:triggered_by]).to be_a(Hash)
+ expect(subject[:triggered_by][:path]).not_to be_nil
+ expect(subject[:triggered_by][:details]).not_to be_nil
+ expect(subject[:triggered_by][:details][:status]).not_to be_nil
+ expect(subject[:triggered_by][:project]).not_to be_nil
+ end
+ end
+
+ context 'when pipeline triggered other pipeline' do
+ let(:pipeline) { create(:ci_empty_pipeline) }
+ let(:build) { create(:ci_build, pipeline: pipeline) }
+
+ before do
+ create(:ci_sources_pipeline, source_job: build)
+ create(:ci_sources_pipeline, source_job: build)
+ end
+
+ it 'contains an information about depedent pipeline' do
+ expect(subject[:triggered]).to be_a(Array)
+ expect(subject[:triggered].length).to eq(2)
+ expect(subject[:triggered].first[:path]).not_to be_nil
+ expect(subject[:triggered].first[:details]).not_to be_nil
+ expect(subject[:triggered].first[:details][:status]).not_to be_nil
+ expect(subject[:triggered].first[:project]).not_to be_nil
+ end
+ end
end
end