diff options
Diffstat (limited to 'spec/factories/ci/job_artifacts.rb')
-rw-r--r-- | spec/factories/ci/job_artifacts.rb | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/spec/factories/ci/job_artifacts.rb b/spec/factories/ci/job_artifacts.rb index 0abebd14286..47c9842e698 100644 --- a/spec/factories/ci/job_artifacts.rb +++ b/spec/factories/ci/job_artifacts.rb @@ -9,22 +9,24 @@ FactoryGirl.define do artifact.project ||= artifact.job.project end - after :create do |artifact| - if artifact.archive? - artifact.file = fixture_file_upload(Rails.root.join('spec/fixtures/ci_build_artifacts.zip'), - 'application/zip') - artifact.save + trait :archive do + after(:create) do |artifact, _| + artifact.update!( + file_type: :archive, + file: fixture_file_upload( + Rails.root.join('spec/fixtures/ci_build_artifacts.zip'), 'application/zip') + ) end end - end - - factory :ci_job_metadata, parent: :ci_job_artifact do - file_type :metadata - after :create do |artifact| - artifact.file = fixture_file_upload(Rails.root.join('spec/fixtures/ci_build_artifacts_metadata.gz'), - 'application/x-gzip') - artifact.save + trait :metadata do + after(:create) do |artifact, _| + artifact.update!( + file_type: :metadata, + file: fixture_file_upload( + Rails.root.join('spec/fixtures/ci_build_artifacts_metadata.gz'), 'application/x-gzip') + ) + end end end end |