2018-03-17 18:26:18 +05:30
|
|
|
FactoryBot.define do
|
2015-09-25 12:07:36 +05:30
|
|
|
factory :ci_runner, class: Ci::Runner do
|
2017-08-17 22:00:37 +05:30
|
|
|
sequence(:description) { |n| "My runner#{n}" }
|
2015-09-25 12:07:36 +05:30
|
|
|
|
2016-04-02 18:10:28 +05:30
|
|
|
platform "darwin"
|
|
|
|
active true
|
2018-03-17 18:26:18 +05:30
|
|
|
access_level :not_protected
|
2015-09-25 12:07:36 +05:30
|
|
|
|
2018-11-08 19:23:39 +05:30
|
|
|
runner_type :instance_type
|
|
|
|
|
2017-08-17 22:00:37 +05:30
|
|
|
trait :online do
|
2018-12-05 23:21:45 +05:30
|
|
|
contacted_at { Time.now }
|
2017-08-17 22:00:37 +05:30
|
|
|
end
|
|
|
|
|
2018-11-08 19:23:39 +05:30
|
|
|
trait :instance do
|
|
|
|
runner_type :instance_type
|
|
|
|
end
|
|
|
|
|
|
|
|
trait :group do
|
|
|
|
runner_type :group_type
|
|
|
|
|
|
|
|
after(:build) do |runner, evaluator|
|
|
|
|
runner.groups << build(:group) if runner.groups.empty?
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
trait :project do
|
|
|
|
runner_type :project_type
|
|
|
|
|
|
|
|
after(:build) do |runner, evaluator|
|
|
|
|
runner.projects << build(:project) if runner.projects.empty?
|
|
|
|
end
|
2015-09-25 12:07:36 +05:30
|
|
|
end
|
2016-09-29 09:46:39 +05:30
|
|
|
|
2018-11-08 19:23:39 +05:30
|
|
|
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
|
2017-08-17 22:00:37 +05:30
|
|
|
end
|
|
|
|
|
2016-09-29 09:46:39 +05:30
|
|
|
trait :inactive do
|
|
|
|
active false
|
|
|
|
end
|
2018-03-17 18:26:18 +05:30
|
|
|
|
|
|
|
trait :ref_protected do
|
|
|
|
access_level :ref_protected
|
|
|
|
end
|
2015-09-25 12:07:36 +05:30
|
|
|
end
|
|
|
|
end
|