Skip to content

Commit

Permalink
Improve database cleaner config according to docs
Browse files Browse the repository at this point in the history
  • Loading branch information
Splines committed May 1, 2024
1 parent 1983c6f commit f8d1872
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions spec/support/database_cleaner.rb
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
# See the docs here: https://www.rubydoc.info/github/DatabaseCleaner/database_cleaner
RSpec.configure do |config|
config.before(:suite) do
DatabaseCleaner.clean_with(:truncation, except: ["ar_internal_metadata"])
end

config.before(:each) do
DatabaseCleaner.strategy = :transaction
DatabaseCleaner.clean_with(:truncation, except: ["ar_internal_metadata"])
end

config.before(:each) do
DatabaseCleaner.start
end

config.after(:each) do
DatabaseCleaner.clean
config.around(:each) do |example|
DatabaseCleaner.cleaning do
example.run
end
end
end

0 comments on commit f8d1872

Please sign in to comment.