diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2024-01-11 15:09:29 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2024-01-11 15:09:29 +0300 |
commit | 97feef1f73fd0a3237d1a2aef4e977e7e27ecace (patch) | |
tree | 4153af3602f242ed1a138fe70bd843a2564dab19 /spec/support/database | |
parent | 6f5be4b446db2f17fc0307c4fce8ae285b35d89a (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/support/database')
-rw-r--r-- | spec/support/database/prevent_cross_database_modification.rb | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/spec/support/database/prevent_cross_database_modification.rb b/spec/support/database/prevent_cross_database_modification.rb index 02572d011f7..948bc21dafa 100644 --- a/spec/support/database/prevent_cross_database_modification.rb +++ b/spec/support/database/prevent_cross_database_modification.rb @@ -68,4 +68,11 @@ RSpec.configure do |config| ::ApplicationRecord.gitlab_transactions_stack.clear end + + config.before(:suite) do + ActiveSupport::Notifications.subscribe("factory_bot.run_factory") do |_name, _start, _finish, _id, payload| + strategy = payload[:strategy] + Thread.current[:factory_bot_objects] -= 1 if strategy == :create + end + end end |