diff options
Diffstat (limited to 'spec/factories/ci/runners.rb')
-rw-r--r-- | spec/factories/ci/runners.rb | 31 |
1 files changed, 27 insertions, 4 deletions
diff --git a/spec/factories/ci/runners.rb b/spec/factories/ci/runners.rb index cdc170b9ccb..6fb621b5e51 100644 --- a/spec/factories/ci/runners.rb +++ b/spec/factories/ci/runners.rb @@ -3,22 +3,45 @@ FactoryBot.define do sequence(:description) { |n| "My runner#{n}" } platform "darwin" - is_shared false active true access_level :not_protected - runner_type :project_type + + is_shared true + runner_type :instance_type trait :online do contacted_at Time.now end - trait :shared do + trait :instance do is_shared true runner_type :instance_type end - trait :specific do + trait :group do + is_shared false + runner_type :group_type + + after(:build) do |runner, evaluator| + runner.groups << build(:group) if runner.groups.empty? + end + end + + trait :project do is_shared false + runner_type :project_type + + after(:build) do |runner, evaluator| + runner.projects << build(:project) if runner.projects.empty? + end + end + + 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 trait :inactive do |