2019-07-25 05:11:48 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-12-14 00:13:44 +00:00
|
|
|
FactoryBot.define do
|
2020-01-09 18:07:52 +00:00
|
|
|
factory :ci_runner, class: 'Ci::Runner' do
|
2017-03-23 13:08:39 +00:00
|
|
|
sequence(:description) { |n| "My runner#{n}" }
|
2015-08-26 01:42:46 +00:00
|
|
|
|
2019-10-02 00:06:26 +00:00
|
|
|
platform { "darwin" }
|
|
|
|
active { true }
|
|
|
|
access_level { :not_protected }
|
2015-08-26 01:42:46 +00:00
|
|
|
|
2019-10-02 00:06:26 +00:00
|
|
|
runner_type { :instance_type }
|
2016-12-27 12:15:14 +00:00
|
|
|
|
2018-05-23 13:29:48 +00:00
|
|
|
trait :online do
|
2018-09-20 17:02:36 +00:00
|
|
|
contacted_at { Time.now }
|
2018-05-23 13:29:48 +00:00
|
|
|
end
|
|
|
|
|
2018-05-23 11:23:49 +00:00
|
|
|
trait :instance do
|
2019-10-02 00:06:26 +00:00
|
|
|
runner_type { :instance_type }
|
2015-08-26 01:42:46 +00:00
|
|
|
end
|
2016-09-12 22:36:16 +00:00
|
|
|
|
2018-05-11 10:03:40 +00:00
|
|
|
trait :group do
|
2019-10-02 00:06:26 +00:00
|
|
|
runner_type { :group_type }
|
2018-05-28 10:55:13 +00:00
|
|
|
|
|
|
|
after(:build) do |runner, evaluator|
|
|
|
|
runner.groups << build(:group) if runner.groups.empty?
|
|
|
|
end
|
2018-05-11 10:03:40 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
trait :project do
|
2019-10-02 00:06:26 +00:00
|
|
|
runner_type { :project_type }
|
2018-05-28 10:55:13 +00:00
|
|
|
|
|
|
|
after(:build) do |runner, evaluator|
|
|
|
|
runner.projects << build(:project) if runner.projects.empty?
|
|
|
|
end
|
2018-05-11 10:03:40 +00:00
|
|
|
end
|
|
|
|
|
2018-05-28 15:58:46 +00:00
|
|
|
trait :without_projects do
|
|
|
|
# we use that to create invalid runner:
|
|
|
|
# the one without projects
|
|
|
|
after(:create) do |runner, evaluator|
|
|
|
|
runner.runner_projects.delete_all
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2016-09-12 22:36:16 +00:00
|
|
|
trait :inactive do
|
2019-10-02 00:06:26 +00:00
|
|
|
active { false }
|
2016-09-12 22:36:16 +00:00
|
|
|
end
|
2017-08-21 08:24:44 +00:00
|
|
|
|
2017-08-29 06:56:03 +00:00
|
|
|
trait :ref_protected do
|
2019-10-02 00:06:26 +00:00
|
|
|
access_level { :ref_protected }
|
2017-08-21 08:24:44 +00:00
|
|
|
end
|
2018-10-18 13:21:40 +00:00
|
|
|
|
|
|
|
trait :tagged_only do
|
2019-10-02 00:06:26 +00:00
|
|
|
run_untagged { false }
|
2018-10-18 13:21:40 +00:00
|
|
|
|
2019-10-02 00:06:26 +00:00
|
|
|
tag_list { %w(tag1 tag2) }
|
2018-10-18 13:21:40 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
trait :locked do
|
2019-10-02 00:06:26 +00:00
|
|
|
locked { true }
|
2018-10-18 13:21:40 +00:00
|
|
|
end
|
2015-08-26 01:42:46 +00:00
|
|
|
end
|
|
|
|
end
|