Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'spec/factories/ci/runners.rb')
-rw-r--r--spec/factories/ci/runners.rb14
1 files changed, 13 insertions, 1 deletions
diff --git a/spec/factories/ci/runners.rb b/spec/factories/ci/runners.rb
index 30f78531324..d0853df4e4b 100644
--- a/spec/factories/ci/runners.rb
+++ b/spec/factories/ci/runners.rb
@@ -10,6 +10,16 @@ FactoryBot.define do
runner_type { :instance_type }
+ transient do
+ projects { [] }
+ end
+
+ after(:build) do |runner, evaluator|
+ evaluator.projects.each do |proj|
+ runner.runner_projects << build(:ci_runner_project, project: proj)
+ end
+ end
+
trait :online do
contacted_at { Time.now }
end
@@ -30,7 +40,9 @@ FactoryBot.define do
runner_type { :project_type }
after(:build) do |runner, evaluator|
- runner.projects << build(:project) if runner.projects.empty?
+ if runner.runner_projects.empty?
+ runner.runner_projects << build(:ci_runner_project)
+ end
end
end