diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-07-10 15:09:15 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-07-10 15:09:15 +0300 |
commit | 60a52d9829a3096dbeb78558081d95761abe1801 (patch) | |
tree | e9e542e51b26bb39867b7500ad5ca2c4de212b03 /spec/serializers/pipeline_details_entity_spec.rb | |
parent | cdd71cf36a45b72d8207fe4fcfc4e44a405d3607 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/serializers/pipeline_details_entity_spec.rb')
-rw-r--r-- | spec/serializers/pipeline_details_entity_spec.rb | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/spec/serializers/pipeline_details_entity_spec.rb b/spec/serializers/pipeline_details_entity_spec.rb index 55bb9720957..35ce7c7175c 100644 --- a/spec/serializers/pipeline_details_entity_spec.rb +++ b/spec/serializers/pipeline_details_entity_spec.rb @@ -157,20 +157,30 @@ RSpec.describe PipelineDetailsEntity do context 'when pipeline triggered other pipeline' do let(:pipeline) { create(:ci_empty_pipeline) } - let(:build) { create(:ci_build, pipeline: pipeline) } + let(:build) { create(:ci_build, name: 'child', stage: 'test', pipeline: pipeline) } + let(:bridge) { create(:ci_bridge, name: 'cross-project', stage: 'build', pipeline: pipeline) } + let(:child_pipeline) { create(:ci_pipeline, project: pipeline.project) } + let(:cross_project_pipeline) { create(:ci_pipeline) } before do - create(:ci_sources_pipeline, source_job: build) - create(:ci_sources_pipeline, source_job: build) + create(:ci_sources_pipeline, source_job: build, pipeline: child_pipeline) + create(:ci_sources_pipeline, source_job: bridge, pipeline: cross_project_pipeline) end - it 'contains an information about depedent pipeline' do + it 'contains an information about dependent pipeline', :aggregate_failures 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 + + source_jobs = subject[:triggered] + .index_by { |pipeline| pipeline[:id] } + .transform_values { |pipeline| pipeline.fetch(:source_job) } + + expect(source_jobs[cross_project_pipeline.id][:name]).to eq('cross-project') + expect(source_jobs[child_pipeline.id][:name]).to eq('child') end end end |