demarches-normaliennes/spec/support/database_cleaner.rb

24 lines
453 B
Ruby
Raw Normal View History

RSpec.configure do |config|
2018-10-01 13:55:12 +02:00
expect_list = []
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 = :deletion, { except: expect_list }
2015-08-24 11:42:06 +02:00
end
config.before(:each) do
DatabaseCleaner.start
end
config.after(:each) do
DatabaseCleaner.clean
end
end