pipelines.rb 1.3 KB
Newer Older
D
Douwe Maan 已提交
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
D
Douwe Maan 已提交
17 18 19
#

FactoryGirl.define do
20
  factory :ci_empty_pipeline, class: Ci::Pipeline do
D
Douwe Maan 已提交
21 22
    sha '97de212e80737a608d939f648d959671fb0a0142'

K
Kamil Trzcinski 已提交
23
    project factory: :empty_project
K
WIP  
Kamil Trzcinski 已提交
24

25
    factory :ci_pipeline_without_jobs do
K
Kamil Trzcinski 已提交
26
      after(:build) do |commit|
27
        allow(commit).to receive(:ci_yaml_file) { YAML.dump({}) }
D
Douwe Maan 已提交
28 29 30
      end
    end

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

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

43
    factory :ci_pipeline do
K
Kamil Trzcinski 已提交
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')) }
D
Douwe Maan 已提交
46 47 48 49
      end
    end
  end
end