2012-08-23 05:19:40 -04: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 15:53:46 -05:00
|
|
|
unless example.metadata[:no_db]
|
|
|
|
DatabaseCleaner.start
|
|
|
|
end
|
2012-08-23 05:19:40 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
config.after do
|
2013-02-26 15:53:46 -05:00
|
|
|
unless example.metadata[:no_db]
|
|
|
|
DatabaseCleaner.clean
|
|
|
|
end
|
2012-08-23 05:19:40 -04:00
|
|
|
end
|
|
|
|
end
|