Skip to content

Instantly share code, notes, and snippets.

@workmad3
Created October 8, 2015 15:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save workmad3/068303504358de3494b6 to your computer and use it in GitHub Desktop.
Save workmad3/068303504358de3494b6 to your computer and use it in GitHub Desktop.
require 'database_cleaner'
RSpec.configure do |config|
config.use_transactional_fixtures = false
DatabaseCleaner.logger = Rails.logger
config.before(:all) do
DatabaseCleaner.clean_with(:truncation)
end
config.before do
DatabaseCleaner.strategy = :transaction
end
config.before(js: true) do
DatabaseCleaner.strategy = :truncation
end
config.before(type: :smoke) do
DatabaseCleaner.strategy = :truncation
end
config.before do
DatabaseCleaner.start
end
config.after do
begin
DatabaseCleaner.clean
rescue
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment