2017-12-13 19:13:44 -05:00
|
|
|
FactoryBot.define do
|
2015-09-09 07:37:50 -04:00
|
|
|
factory :ci_runner, class: Ci::Runner do
|
2017-03-23 09:08:39 -04:00
|
|
|
sequence(:description) { |n| "My runner#{n}" }
|
2015-08-25 21:42:46 -04:00
|
|
|
|
2016-02-17 16:20:09 -05:00
|
|
|
platform "darwin"
|
|
|
|
active true
|
2017-09-02 03:31:14 -04:00
|
|
|
access_level :not_protected
|
2015-08-25 21:42:46 -04:00
|
|
|
|
2018-05-23 07:23:49 -04:00
|
|
|
runner_type :instance_type
|
2016-12-27 07:15:14 -05:00
|
|
|
|
2018-05-23 09:29:48 -04:00
|
|
|
trait :online do
|
2018-09-20 13:02:36 -04:00
|
|
|
contacted_at { Time.now }
|
2018-05-23 09:29:48 -04:00
|
|
|
end
|
|
|
|
|
2018-05-23 07:23:49 -04:00
|
|
|
trait :instance do
|
2018-05-08 11:17:06 -04:00
|
|
|
runner_type :instance_type
|
2015-08-25 21:42:46 -04:00
|
|
|
end
|
2016-09-12 18:36:16 -04:00
|
|
|
|
2018-05-11 06:03:40 -04:00
|
|
|
trait :group do
|
|
|
|
runner_type :group_type
|
2018-05-28 06:55:13 -04:00
|
|
|
|
|
|
|
after(:build) do |runner, evaluator|
|
|
|
|
runner.groups << build(:group) if runner.groups.empty?
|
|
|
|
end
|
2018-05-11 06:03:40 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
trait :project do
|
|
|
|
runner_type :project_type
|
2018-05-28 06:55:13 -04:00
|
|
|
|
|
|
|
after(:build) do |runner, evaluator|
|
|
|
|
runner.projects << build(:project) if runner.projects.empty?
|
|
|
|
end
|
2018-05-11 06:03:40 -04:00
|
|
|
end
|
|
|
|
|
2018-05-28 11:58:46 -04: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 18:36:16 -04:00
|
|
|
trait :inactive do
|
|
|
|
active false
|
|
|
|
end
|
2017-08-21 04:24:44 -04:00
|
|
|
|
2017-08-29 02:56:03 -04:00
|
|
|
trait :ref_protected do
|
2017-08-31 05:28:29 -04:00
|
|
|
access_level :ref_protected
|
2017-08-21 04:24:44 -04:00
|
|
|
end
|
2018-10-18 09:21:40 -04:00
|
|
|
|
|
|
|
trait :tagged_only do
|
|
|
|
run_untagged false
|
|
|
|
|
|
|
|
tag_list %w(tag1 tag2)
|
|
|
|
end
|
|
|
|
|
|
|
|
trait :locked do
|
|
|
|
locked true
|
|
|
|
end
|
2015-08-25 21:42:46 -04:00
|
|
|
end
|
|
|
|
end
|