diff options
Diffstat (limited to 'spec/factories/ci/pipelines.rb')
-rw-r--r-- | spec/factories/ci/pipelines.rb | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/spec/factories/ci/pipelines.rb b/spec/factories/ci/pipelines.rb index 14bd0ab1bc6..86a8b008e48 100644 --- a/spec/factories/ci/pipelines.rb +++ b/spec/factories/ci/pipelines.rb @@ -16,6 +16,7 @@ FactoryBot.define do transient { head_pipeline_of { nil } } transient { child_of { nil } } + transient { upstream_of { nil } } after(:build) do |pipeline, evaluator| if evaluator.child_of @@ -30,9 +31,12 @@ FactoryBot.define do if evaluator.child_of bridge = create(:ci_bridge, pipeline: evaluator.child_of) - create(:ci_sources_pipeline, - source_job: bridge, - pipeline: pipeline) + create(:ci_sources_pipeline, source_job: bridge, pipeline: pipeline) + end + + if evaluator.upstream_of + bridge = create(:ci_bridge, pipeline: pipeline) + create(:ci_sources_pipeline, source_job: bridge, pipeline: evaluator.upstream_of) end end @@ -122,10 +126,10 @@ FactoryBot.define do end trait :with_test_reports_with_three_failures do - status { :success } + status { :failed } after(:build) do |pipeline, _evaluator| - pipeline.builds << build(:ci_build, :test_reports_with_three_failures, pipeline: pipeline, project: pipeline.project) + pipeline.builds << build(:ci_build, :failed, :test_reports_with_three_failures, pipeline: pipeline, project: pipeline.project) end end @@ -145,6 +149,14 @@ FactoryBot.define do end end + trait :with_codequality_reports do + status { :success } + + after(:build) do |pipeline, evaluator| + pipeline.builds << build(:ci_build, :codequality_reports, pipeline: pipeline, project: pipeline.project) + end + end + trait :with_coverage_report_artifact do after(:build) do |pipeline, evaluator| pipeline.pipeline_artifacts << build(:ci_pipeline_artifact, pipeline: pipeline, project: pipeline.project) |