BigW Consortium Gitlab

commits.rb 1.35 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
# == Schema Information
#
# Table name: commits
#
#  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
#

# Read about factories at https://github.com/thoughtbot/factory_girl
FactoryGirl.define do
20
  factory :ci_empty_commit, class: Ci::Commit do
21 22
    sha '97de212e80737a608d939f648d959671fb0a0142'

Kamil Trzcinski committed
23 24
    gl_project factory: :empty_project

25
    factory :ci_commit_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_commit_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_commit_with_two_jobs 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_commit 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