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/factories/ci')
-rw-r--r--spec/factories/ci/pipeline_artifacts.rb17
-rw-r--r--spec/factories/ci/pipelines.rb2
2 files changed, 18 insertions, 1 deletions
diff --git a/spec/factories/ci/pipeline_artifacts.rb b/spec/factories/ci/pipeline_artifacts.rb
new file mode 100644
index 00000000000..ecfd1e79e78
--- /dev/null
+++ b/spec/factories/ci/pipeline_artifacts.rb
@@ -0,0 +1,17 @@
+# frozen_string_literal: true
+
+FactoryBot.define do
+ factory :ci_pipeline_artifact, class: 'Ci::PipelineArtifact' do
+ pipeline factory: :ci_pipeline
+ project { pipeline.project }
+ file_type { :code_coverage }
+ file_format { :raw }
+ file_store { Ci::PipelineArtifact::FILE_STORE_SUPPORTED.first }
+ size { 1.megabytes }
+
+ after(:build) do |artifact, _evaluator|
+ artifact.file = fixture_file_upload(
+ Rails.root.join('spec/fixtures/pipeline_artifacts/code_coverage.json'), 'application/json')
+ end
+ end
+end
diff --git a/spec/factories/ci/pipelines.rb b/spec/factories/ci/pipelines.rb
index 5bd5ab7d67a..2790be8b70d 100644
--- a/spec/factories/ci/pipelines.rb
+++ b/spec/factories/ci/pipelines.rb
@@ -17,7 +17,7 @@ FactoryBot.define do
after(:create) do |pipeline, evaluator|
merge_request = evaluator.head_pipeline_of
- merge_request&.update(head_pipeline: pipeline)
+ merge_request&.update!(head_pipeline: pipeline)
end
factory :ci_pipeline do