database_cleaner.rb 389 B

12345678910111213141516171819202122
  1. RSpec.configure do |config|
  2. config.before(:suite) do
  3. DatabaseCleaner.clean_with(:truncation)
  4. end
  5. config.before(:each) do
  6. DatabaseCleaner.strategy = :transaction
  7. end
  8. config.before(:each, js: true) do
  9. DatabaseCleaner.strategy = :truncation
  10. end
  11. config.before(:each) do
  12. DatabaseCleaner.start
  13. end
  14. config.after(:each) do
  15. DatabaseCleaner.clean
  16. end
  17. end