2017-09-21 04:34:12 -04:00
|
|
|
include ActionDispatch::TestProcess
|
|
|
|
|
2017-12-13 19:13:44 -05:00
|
|
|
FactoryBot.define do
|
2017-09-21 04:34:12 -04:00
|
|
|
factory :ci_job_artifact, class: Ci::JobArtifact do
|
|
|
|
job factory: :ci_build
|
|
|
|
file_type :archive
|
|
|
|
|
2017-11-02 07:16:50 -04:00
|
|
|
after :build do |artifact|
|
|
|
|
artifact.project ||= artifact.job.project
|
|
|
|
end
|
|
|
|
|
2017-11-23 12:51:20 -05:00
|
|
|
trait :archive do
|
2017-11-30 12:32:16 -05:00
|
|
|
file_type :archive
|
|
|
|
|
|
|
|
after(:build) do |artifact, _|
|
|
|
|
artifact.file = fixture_file_upload(
|
2017-12-03 10:21:59 -05:00
|
|
|
Rails.root.join('spec/fixtures/ci_build_artifacts.zip'), 'application/zip')
|
2017-09-21 04:34:12 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2017-11-23 12:51:20 -05:00
|
|
|
trait :metadata do
|
2017-11-30 12:32:16 -05:00
|
|
|
file_type :metadata
|
|
|
|
|
|
|
|
after(:build) do |artifact, _|
|
|
|
|
artifact.file = fixture_file_upload(
|
|
|
|
Rails.root.join('spec/fixtures/ci_build_artifacts_metadata.gz'), 'application/x-gzip')
|
2017-11-23 12:51:20 -05:00
|
|
|
end
|
2017-09-21 04:34:12 -04:00
|
|
|
end
|
2018-01-29 11:56:12 -05:00
|
|
|
|
|
|
|
trait :trace do
|
|
|
|
file_type :trace
|
|
|
|
|
|
|
|
after(:build) do |artifact, evaluator|
|
|
|
|
artifact.file = fixture_file_upload(
|
2018-02-05 04:11:13 -05:00
|
|
|
Rails.root.join('spec/fixtures/trace/sample_trace'), 'text/plain')
|
2018-01-29 11:56:12 -05:00
|
|
|
end
|
|
|
|
end
|
2017-09-21 04:34:12 -04:00
|
|
|
end
|
|
|
|
end
|