demarches-normaliennes/spec/support/database_cleaner.rb

26 lines
459 B
Ruby
Raw Normal View History

RSpec.configure do |config|
2015-08-24 11:42:06 +02:00
expect_list = %w()
2015-08-24 11:42:06 +02:00
config.before(:suite) do
2015-08-24 11:42:06 +02:00
DatabaseCleaner.clean_with(:truncation, except: expect_list)
end
config.before(:each) do
DatabaseCleaner.strategy = :transaction
end
2015-08-24 11:42:06 +02:00
config.before(:each, js: true) do
DatabaseCleaner.strategy = :truncation, { except: expect_list }
end
config.before(:each) do
DatabaseCleaner.start
end
config.after(:each) do
DatabaseCleaner.clean
end
end