BigW Consortium Gitlab

pipelines.rb 1.33 KB
Newer Older
1 2 3 4
# == Schema Information
#
# Table name: commits
#
5 6 7 8 9 10 11 12 13 14 15 16
#  id             :integer          not null, primary key
#  project_id     :integer
#  ref            :string(255)
#  sha            :string(255)
#  before_sha     :string(255)
#  push_data      :text
#  created_at     :datetime
#  updated_at     :datetime
#  tag            :boolean          default(FALSE)
#  yaml_errors    :text
#  committed_at   :datetime
#  gl_project_id  :integer
17 18 19
#

FactoryGirl.define do
20
  factory :ci_empty_pipeline, class: Ci::Pipeline do
21 22
    sha '97de212e80737a608d939f648d959671fb0a0142'

23
    project factory: :empty_project
Kamil Trzcinski committed
24

25
    factory :ci_pipeline_without_jobs do
Kamil Trzcinski committed
26
      after(:build) do |commit|
27
        allow(commit).to receive(:ci_yaml_file) { YAML.dump({}) }
28 29 30
      end
    end

31
    factory :ci_pipeline_with_one_job do
Kamil Trzcinski committed
32
      after(:build) do |commit|
Kamil Trzcinski committed
33
        allow(commit).to receive(:ci_yaml_file) { YAML.dump({ rspec: { script: "ls" } }) }
34 35 36
      end
    end

37
    factory :ci_pipeline_with_two_job do
Kamil Trzcinski committed
38
      after(:build) do |commit|
Kamil Trzcinski committed
39
        allow(commit).to receive(:ci_yaml_file) { YAML.dump({ rspec: { script: "ls" }, spinach: { script: "ls" } }) }
Kamil Trzcinski committed
40 41 42
      end
    end

43
    factory :ci_pipeline do
Kamil Trzcinski committed
44 45
      after(:build) do |commit|
        allow(commit).to receive(:ci_yaml_file) { File.read(Rails.root.join('spec/support/gitlab_stubs/gitlab_ci.yml')) }
46 47 48 49
      end
    end
  end
end