summaryrefslogtreecommitdiff
path: root/spec/factories/ci/runners.rb
diff options
context:
space:
mode:
authorAlessio Caiazza <acaiazza@gitlab.com>2018-06-04 13:57:51 +0200
committerAlessio Caiazza <acaiazza@gitlab.com>2018-06-04 13:57:51 +0200
commit8ffcaf3b85fdf716ffeacf4e9d4c89b922de50b9 (patch)
tree2e6acfa369e3e659ef4c6afb9290ad122a8fea5c /spec/factories/ci/runners.rb
parent1841da16abe864b3dae19636fee9e9bbe9a01b56 (diff)
parent23ae072ba2d601a3639a32f5a29302c430106bb8 (diff)
downloadgitlab-ce-11-0-stable-prepare-rc2.tar.gz
Merge branch 'master' into 11-0-stable-prepare-rc211-0-stable-prepare-rc2
Diffstat (limited to 'spec/factories/ci/runners.rb')
-rw-r--r--spec/factories/ci/runners.rb31
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