gitlab-org--gitlab-foss/spec/factories/ci/commits.rb

50 lines
1.3 KiB
Ruby
Raw Normal View History

2015-08-25 21:42:46 -04:00
# == 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
factory :ci_commit, class: Ci::Commit do
2015-08-25 21:42:46 -04:00
sha '97de212e80737a608d939f648d959671fb0a0142'
2015-09-28 07:14:34 -04:00
gl_project factory: :empty_project
factory :ci_commit_without_jobs do
2015-10-05 06:02:26 -04:00
after(:build) do |commit|
allow(commit).to receive(:ci_yaml_file) { YAML.dump({}) }
2015-08-25 21:42:46 -04:00
end
end
factory :ci_commit_with_one_job do
2015-10-05 06:02:26 -04:00
after(:build) do |commit|
allow(commit).to receive(:ci_yaml_file) { YAML.dump({rspec: {script: "ls"}}) }
2015-08-25 21:42:46 -04:00
end
end
factory :ci_commit_with_two_jobs do
2015-10-05 06:02:26 -04:00
after(:build) do |commit|
allow(commit).to receive(:ci_yaml_file) { YAML.dump({rspec: {script: "ls"}, spinach: {script: "ls"}}) }
end
end
factory :ci_commit_yaml_stub do
after(:build) do |commit|
allow(commit).to receive(:ci_yaml_file) { File.read(Rails.root.join('spec/support/gitlab_stubs/gitlab_ci.yml')) }
2015-08-25 21:42:46 -04:00
end
end
end
end