summaryrefslogtreecommitdiff
path: root/spec/factories
diff options
context:
space:
mode:
authorFelipe Artur <felipefac@gmail.com>2017-05-19 17:51:07 -0300
committerFelipe Artur <felipefac@gmail.com>2017-05-22 17:06:45 -0300
commit921c2be44af6a5a2af2b6e17945f0301c8158214 (patch)
tree1f2dc10b8661d6f6c95cd97433f1faf6d67b6852 /spec/factories
parent9d29eb7e292067fb980b4ca97fc6c3edac1dccec (diff)
downloadgitlab-ce-921c2be44af6a5a2af2b6e17945f0301c8158214.tar.gz
Add transient head_pipeline_of to pipeline factoriesissue_32225
Diffstat (limited to 'spec/factories')
-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 }