2016-06-02 11:05:42 +05:30
|
|
|
include ActionDispatch::TestProcess
|
|
|
|
|
2015-09-25 12:07:36 +05:30
|
|
|
FactoryGirl.define do
|
|
|
|
factory :ci_build, class: Ci::Build do
|
2015-10-24 18:46:33 +05:30
|
|
|
name 'test'
|
|
|
|
ref 'master'
|
|
|
|
tag false
|
2016-01-19 16:12:03 +05:30
|
|
|
created_at 'Di 29. Okt 09:50:00 CET 2013'
|
2015-09-25 12:07:36 +05:30
|
|
|
started_at 'Di 29. Okt 09:51:28 CET 2013'
|
|
|
|
finished_at 'Di 29. Okt 09:53:28 CET 2013'
|
|
|
|
commands 'ls -a'
|
|
|
|
options do
|
|
|
|
{
|
|
|
|
image: "ruby:2.1",
|
|
|
|
services: ["postgres"]
|
|
|
|
}
|
|
|
|
end
|
|
|
|
|
2016-06-16 23:09:34 +05:30
|
|
|
pipeline factory: :ci_pipeline
|
2015-09-25 12:07:36 +05:30
|
|
|
|
2016-04-02 18:10:28 +05:30
|
|
|
trait :success do
|
|
|
|
status 'success'
|
|
|
|
end
|
|
|
|
|
|
|
|
trait :failed do
|
|
|
|
status 'failed'
|
|
|
|
end
|
|
|
|
|
2016-01-19 16:12:03 +05:30
|
|
|
trait :canceled do
|
|
|
|
status 'canceled'
|
|
|
|
end
|
|
|
|
|
2016-04-02 18:10:28 +05:30
|
|
|
trait :running do
|
|
|
|
status 'running'
|
|
|
|
end
|
|
|
|
|
|
|
|
trait :pending do
|
|
|
|
status 'pending'
|
|
|
|
end
|
|
|
|
|
|
|
|
trait :allowed_to_fail do
|
|
|
|
allow_failure true
|
|
|
|
end
|
|
|
|
|
2015-12-23 02:04:40 +05:30
|
|
|
after(:build) do |build, evaluator|
|
2016-06-16 23:09:34 +05:30
|
|
|
build.project = build.pipeline.project
|
2015-12-23 02:04:40 +05:30
|
|
|
end
|
|
|
|
|
2015-09-25 12:07:36 +05:30
|
|
|
factory :ci_not_started_build do
|
|
|
|
started_at nil
|
|
|
|
finished_at nil
|
|
|
|
end
|
2015-10-24 18:46:33 +05:30
|
|
|
|
|
|
|
factory :ci_build_tag do
|
|
|
|
tag true
|
|
|
|
end
|
2016-01-19 16:12:03 +05:30
|
|
|
|
2016-06-02 11:05:42 +05:30
|
|
|
factory :ci_build_with_coverage do
|
|
|
|
coverage 99.9
|
|
|
|
end
|
|
|
|
|
2016-04-02 18:10:28 +05:30
|
|
|
trait :trace do
|
|
|
|
after(:create) do |build, evaluator|
|
2016-01-19 16:12:03 +05:30
|
|
|
build.trace = 'BUILD TRACE'
|
|
|
|
end
|
|
|
|
end
|
2016-04-02 18:10:28 +05:30
|
|
|
|
|
|
|
trait :artifacts do
|
|
|
|
after(:create) do |build, _|
|
|
|
|
build.artifacts_file =
|
|
|
|
fixture_file_upload(Rails.root.join('spec/fixtures/ci_build_artifacts.zip'),
|
|
|
|
'application/zip')
|
|
|
|
|
|
|
|
build.artifacts_metadata =
|
|
|
|
fixture_file_upload(Rails.root.join('spec/fixtures/ci_build_artifacts_metadata.gz'),
|
|
|
|
'application/x-gzip')
|
2016-06-02 11:05:42 +05:30
|
|
|
|
2016-04-02 18:10:28 +05:30
|
|
|
build.save!
|
|
|
|
end
|
|
|
|
end
|
2015-09-25 12:07:36 +05:30
|
|
|
end
|
|
|
|
end
|