The best of database_cleaner setting
RSpec.configure do |config|
# Use transactions by default
config.before :each do
DatabaseRewinder.strategy = :transaction
end
# Switch to truncation for javascript tests, but *only clean used tables*
config.before :each, js: true do
DatabaseRewinder.strategy = :truncation, {pre_count: true}
end
config.before :each do
DatabaseRewinder.start
end
config.after :each do
DatabaseRewinder.clean
end
end