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/support/factory_bot.rb')
-rw-r--r--spec/support/factory_bot.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/spec/support/factory_bot.rb b/spec/support/factory_bot.rb
index 6faa2db3330..d30098a5cc0 100644
--- a/spec/support/factory_bot.rb
+++ b/spec/support/factory_bot.rb
@@ -1,5 +1,19 @@
# frozen_string_literal: true
+FactoryBot.define do
+ after(:build) do |object, _|
+ next unless object.respond_to?(:factory_bot_built=)
+
+ object.factory_bot_built = true
+ end
+
+ before(:create) do |object, _|
+ next unless object.respond_to?(:factory_bot_built=)
+
+ object.factory_bot_built = false
+ end
+end
+
FactoryBot::SyntaxRunner.class_eval do
include RSpec::Mocks::ExampleMethods
include StubMethodCalls