Skip to content

Commit

Permalink
Attempt to fix DatabaseCleaner for Ruby 3.0 (DatabaseCleaner/database…
Browse files Browse the repository at this point in the history
  • Loading branch information
ronaldtse committed Dec 22, 2021
1 parent 7deac77 commit 0490b3c
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion spec/support/db_cleaner.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@
# Therefore, they are specified explicitly here.
unless WITHOUT_MONGOID
require "database_cleaner-mongoid"
DatabaseCleaner[:mongoid].strategy = :deletion, { only: %w[users] }
strategy = DatabaseCleaner::Mongoid::Deletion.new(only: %w[users])
DatabaseCleaner[:mongoid].instance_variable_set :'@strategy', strategy
DatabaseCleaner[:mongoid].start
end

DatabaseCleaner.clean
Expand Down

0 comments on commit 0490b3c

Please sign in to comment.