2016-02-16 22:55:24 -05:00
|
|
|
include ActionDispatch::TestProcess
|
|
|
|
|
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
|
|
|
|
|
2016-06-03 06:29:00 -04:00
|
|
|
pipeline factory: :ci_commit
|
2015-09-15 14:51:03 -04:00
|
|
|
|
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
|
|
|
|
|
2016-02-18 05:47:35 -05:00
|
|
|
trait :running do
|
|
|
|
status 'running'
|
|
|
|
end
|
|
|
|
|
|
|
|
trait :pending do
|
|
|
|
status 'pending'
|
|
|
|
end
|
|
|
|
|
|
|
|
trait :allowed_to_fail do
|
|
|
|
allow_failure true
|
|
|
|
end
|
|
|
|
|
2015-12-04 06:55:23 -05:00
|
|
|
after(:build) do |build, evaluator|
|
2016-06-03 07:09:49 -04:00
|
|
|
build.project = build.pipeline.project
|
2015-12-04 06:55:23 -05:00
|
|
|
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
|
|
|
|
2016-02-04 05:08:58 -05:00
|
|
|
factory :ci_build_with_coverage do
|
|
|
|
coverage 99.9
|
|
|
|
end
|
|
|
|
|
2016-02-19 12:06:53 -05:00
|
|
|
trait :trace do
|
2016-02-01 05:29:41 -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 =
|
2016-02-03 05:24:44 -05:00
|
|
|
fixture_file_upload(Rails.root.join('spec/fixtures/ci_build_artifacts.zip'),
|
|
|
|
'application/zip')
|
2016-02-02 09:51:48 -05:00
|
|
|
|
|
|
|
build.artifacts_metadata =
|
2016-02-03 05:24:44 -05:00
|
|
|
fixture_file_upload(Rails.root.join('spec/fixtures/ci_build_artifacts_metadata.gz'),
|
2016-02-10 08:09:11 -05:00
|
|
|
'application/x-gzip')
|
2016-02-04 05:08:58 -05:00
|
|
|
|
2016-02-02 09:51:48 -05:00
|
|
|
build.save!
|
|
|
|
end
|
|
|
|
end
|
2015-08-25 21:42:46 -04:00
|
|
|
end
|
|
|
|
end
|