Commit 2773702a authored by Rémy Coutable's avatar Rémy Coutable

Make sure to change the DB cleaning strategy for Geo::BaseRegistry too in...

Make sure to change the DB cleaning strategy for Geo::BaseRegistry too in spec/services/groups/destroy_service_spec.rb
Signed-off-by: default avatarRémy Coutable <remy@rymai.me>
parent de31766d
......@@ -86,12 +86,20 @@ describe Groups::DestroyService do
context 'potential race conditions' do
context "when the `GroupDestroyWorker` task runs immediately" do
around do |example|
old_strategy = DatabaseCleaner[:active_record, { connection: ActiveRecord::Base }].strategy
DatabaseCleaner[:active_record, { connection: ActiveRecord::Base }].strategy = :deletion
connections = [ActiveRecord::Base, Geo::BaseRegistry]
old_connections = connections.each_with_object({}) do |connection, memo|
memo[connection] = DatabaseCleaner[:active_record, { connection: connection }].strategy
DatabaseCleaner[:active_record, { connection: connection }].strategy = :deletion
memo
end
begin
example.run
ensure
DatabaseCleaner[:active_record, { connection: ActiveRecord::Base }].strategy = old_strategy
old_connections.each do |connection, old_strategy|
DatabaseCleaner[:active_record, { connection: connection }].strategy = old_strategy
end
end
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment