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/pipeline_artifacts.rb')
-rw-r--r--spec/factories/ci/pipeline_artifacts.rb33
1 files changed, 29 insertions, 4 deletions
diff --git a/spec/factories/ci/pipeline_artifacts.rb b/spec/factories/ci/pipeline_artifacts.rb
index fa33609dd6c..05ff7afed7c 100644
--- a/spec/factories/ci/pipeline_artifacts.rb
+++ b/spec/factories/ci/pipeline_artifacts.rb
@@ -4,18 +4,30 @@ 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 { ObjectStorage::SUPPORTED_STORES.first }
- size { 1.megabytes }
-
+ size { 1.megabyte }
+ file_type { :code_coverage }
after(:build) do |artifact, _evaluator|
artifact.file = fixture_file_upload(
Rails.root.join('spec/fixtures/pipeline_artifacts/code_coverage.json'), 'application/json')
end
- trait :with_multibyte_characters do
+ trait :with_coverage_report do
+ file_type { :code_coverage }
+
+ after(:build) do |artifact, _evaluator|
+ artifact.file = fixture_file_upload(
+ Rails.root.join('spec/fixtures/pipeline_artifacts/code_coverage.json'), 'application/json')
+ end
+
+ size { file.size }
+ end
+
+ trait :with_coverage_multibyte_characters do
+ file_type { :code_coverage }
size { { "utf8" => "✓" }.to_json.bytesize }
+
after(:build) do |artifact, _evaluator|
artifact.file = CarrierWaveStringFile.new_file(
file_content: { "utf8" => "✓" }.to_json,
@@ -26,12 +38,25 @@ FactoryBot.define do
end
trait :with_code_coverage_with_multiple_files do
+ file_type { :code_coverage }
+
after(:build) do |artifact, _evaluator|
artifact.file = fixture_file_upload(
Rails.root.join('spec/fixtures/pipeline_artifacts/code_coverage_with_multiple_files.json'), 'application/json'
)
end
+ size { 1.megabyte }
+ end
+
+ trait :with_codequality_mr_diff_report do
+ file_type { :code_quality_mr_diff }
+
+ after(:build) do |artifact, _evaluator|
+ artifact.file = fixture_file_upload(
+ Rails.root.join('spec/fixtures/pipeline_artifacts/code_quality_mr_diff.json'), 'application/json')
+ end
+
size { file.size }
end
end