2012-08-23 11:19:40 +02:00
|
|
|
require 'database_cleaner'
|
|
|
|
|
|
|
|
RSpec.configure do |config|
|
|
|
|
config.before do
|
|
|
|
if example.metadata[:js]
|
|
|
|
DatabaseCleaner.strategy = :truncation
|
|
|
|
Capybara::Selenium::Driver::DEFAULT_OPTIONS[:resynchronize] = true
|
|
|
|
else
|
|
|
|
DatabaseCleaner.strategy = :transaction
|
|
|
|
end
|
|
|
|
|
2013-02-26 21:53:46 +01:00
|
|
|
unless example.metadata[:no_db]
|
|
|
|
DatabaseCleaner.start
|
|
|
|
end
|
2012-08-23 11:19:40 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
config.after do
|
2013-02-26 21:53:46 +01:00
|
|
|
unless example.metadata[:no_db]
|
|
|
|
DatabaseCleaner.clean
|
|
|
|
end
|
2012-08-23 11:19:40 +02:00
|
|
|
end
|
|
|
|
end
|