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:
authorFelipe Artur <felipefac@gmail.com>2017-05-19 23:51:07 +0300
committerFelipe Artur <felipefac@gmail.com>2017-05-22 23:06:45 +0300
commit921c2be44af6a5a2af2b6e17945f0301c8158214 (patch)
tree1f2dc10b8661d6f6c95cd97433f1faf6d67b6852 /spec/factories/ci/pipelines.rb
parent9d29eb7e292067fb980b4ca97fc6c3edac1dccec (diff)
Add transient head_pipeline_of to pipeline factories
Diffstat (limited to 'spec/factories/ci/pipelines.rb')
-rw-r--r--spec/factories/ci/pipelines.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/spec/factories/ci/pipelines.rb b/spec/factories/ci/pipelines.rb
index 561fbc8e247..361c5b9a49e 100644
--- a/spec/factories/ci/pipelines.rb
+++ b/spec/factories/ci/pipelines.rb
@@ -20,6 +20,15 @@ FactoryGirl.define do
end
end
+ # Persist merge request head_pipeline_id
+ # on pipeline factories to avoid circular references
+ transient { head_pipeline_of nil }
+
+ after(:create) do |pipeline, evaluator|
+ merge_request = evaluator.head_pipeline_of
+ merge_request&.update(head_pipeline: pipeline)
+ end
+
factory :ci_pipeline do
transient { config nil }