Skip to content

Instantly share code, notes, and snippets.

@stevencwarren
Created August 6, 2012 20:32
Show Gist options
  • Select an option

  • Save stevencwarren/3278187 to your computer and use it in GitHub Desktop.

Select an option

Save stevencwarren/3278187 to your computer and use it in GitHub Desktop.
config.before :suite do
DatabaseCleaner.strategy = :transaction
DatabaseCleaner.clean_with(:truncation)
end
# Request specs cannot use a transaction because Capybara runs in a
# separate thread with a different database connection.
config.before type: :request do
DatabaseCleaner.strategy = :truncation
end
config.before do
DatabaseCleaner.start
end
config.after do
DatabaseCleaner.clean
end
via http://highgroove.com/articles/2012/04/06/sane-rspec-config-for-clean,-and-slightly-faster,-specs.html
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment