gitlabhq/spec/support/db_cleaner.rb

23 lines
465 B
Ruby
Raw Normal View History

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
end
config.after do
2013-02-26 21:53:46 +01:00
unless example.metadata[:no_db]
DatabaseCleaner.clean
end
end
end