Skip to content

Instantly share code, notes, and snippets.

@danielmorrison
Created January 31, 2014 20:46
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save danielmorrison/8742783 to your computer and use it in GitHub Desktop.
Save danielmorrison/8742783 to your computer and use it in GitHub Desktop.
put inside spec/spec_helper.rb inside the RSpec.configure block
config.before(:suite) do
DatabaseCleaner.strategy = :truncation
DatabaseCleaner.clean_with(:truncation)
end
config.around(:each) do |example|
DatabaseCleaner.start
example.run
DatabaseCleaner.clean
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment