Welcome to mirror list, hosted at ThFree Co, Russian Federation.

job_artifacts.rb « ci « factories « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 0abebd14286cc6e29a481c4f24b0d902a36f5c53 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
include ActionDispatch::TestProcess

FactoryGirl.define do
  factory :ci_job_artifact, class: Ci::JobArtifact do
    job factory: :ci_build
    file_type :archive

    after :build do |artifact|
      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
      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
    end
  end
end