Skip to content

Instantly share code, notes, and snippets.

@JunichiIto
Created June 22, 2015 09:34
Show Gist options
  • Save JunichiIto/91f1bbf04964e9687440 to your computer and use it in GitHub Desktop.
Save JunichiIto/91f1bbf04964e9687440 to your computer and use it in GitHub Desktop.
Sample DatabaseCleaner setting
# gem 'database_cleaner', '~> 1.4'
RSpec.configure do |config|
config.before(:suite) do
DatabaseCleaner.clean_with(:truncation)
end
config.before(:each) do
DatabaseCleaner.strategy = :transaction
end
config.before(:each, :js => true) do
DatabaseCleaner.strategy = :truncation
end
config.before(:each) do
DatabaseCleaner.start
end
config.append_after(:each) do
DatabaseCleaner.clean
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment