2015-08-25 21:42:46 -04:00
|
|
|
FactoryGirl.define do
|
2015-09-09 07:37:50 -04:00
|
|
|
factory :ci_build, class: Ci::Build do
|
2015-10-06 06:01:16 -04:00
|
|
|
name 'test'
|
2015-10-05 04:14:33 -04:00
|
|
|
ref 'master'
|
|
|
|
tag false
|
2015-12-30 09:12:07 -05:00
|
|
|
created_at 'Di 29. Okt 09:50:00 CET 2013'
|
2015-08-25 21:42:46 -04:00
|
|
|
started_at 'Di 29. Okt 09:51:28 CET 2013'
|
|
|
|
finished_at 'Di 29. Okt 09:53:28 CET 2013'
|
2015-10-05 08:31:51 -04:00
|
|
|
commands 'ls -a'
|
2015-08-25 21:42:46 -04:00
|
|
|
options do
|
|
|
|
{
|
|
|
|
image: "ruby:2.1",
|
|
|
|
services: ["postgres"]
|
|
|
|
}
|
|
|
|
end
|
|
|
|
|
2015-09-15 14:51:03 -04:00
|
|
|
commit factory: :ci_commit
|
|
|
|
|
2016-02-18 04:52:57 -05:00
|
|
|
trait :success do
|
|
|
|
status 'success'
|
|
|
|
end
|
|
|
|
|
|
|
|
trait :failed do
|
|
|
|
status 'failed'
|
|
|
|
end
|
|
|
|
|
2016-01-13 10:05:49 -05:00
|
|
|
trait :canceled do
|
|
|
|
status 'canceled'
|
|
|
|
end
|
|
|
|
|
2015-12-04 06:55:23 -05:00
|
|
|
after(:build) do |build, evaluator|
|
|
|
|
build.project = build.commit.project
|
|
|
|
end
|
|
|
|
|
2015-09-10 09:52:52 -04:00
|
|
|
factory :ci_not_started_build do
|
2015-08-25 21:42:46 -04:00
|
|
|
started_at nil
|
|
|
|
finished_at nil
|
|
|
|
end
|
2015-10-05 04:14:33 -04:00
|
|
|
|
|
|
|
factory :ci_build_tag do
|
|
|
|
tag true
|
|
|
|
end
|
2015-12-30 09:12:07 -05:00
|
|
|
|
|
|
|
factory :ci_build_with_trace do
|
2016-01-14 06:04:44 -05:00
|
|
|
after(:create) do |build, evaluator|
|
2016-01-11 10:30:01 -05:00
|
|
|
build.trace = 'BUILD TRACE'
|
|
|
|
end
|
2015-12-30 09:12:07 -05:00
|
|
|
end
|
2016-02-02 09:51:48 -05:00
|
|
|
|
|
|
|
trait :artifacts do
|
|
|
|
after(:create) do |build, _|
|
|
|
|
build.artifacts_file =
|
|
|
|
fixture_file_upload(Rails.root +
|
|
|
|
'spec/fixtures/ci_build_artifacts.zip',
|
|
|
|
'application/zip')
|
|
|
|
|
|
|
|
build.artifacts_metadata =
|
|
|
|
fixture_file_upload(Rails.root +
|
|
|
|
'spec/fixtures/ci_build_artifacts_metadata.gz',
|
|
|
|
'application/x-gzip')
|
|
|
|
build.save!
|
|
|
|
end
|
|
|
|
end
|
2015-08-25 21:42:46 -04:00
|
|
|
end
|
|
|
|
end
|