Skip to content

Instantly share code, notes, and snippets.

@jameslafa
Created January 30, 2016 08: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 jameslafa/c42537c6dc3eec593709 to your computer and use it in GitHub Desktop.
Save jameslafa/c42537c6dc3eec593709 to your computer and use it in GitHub Desktop.
Database cleaner with Rspec and a javascript engive
RSpec.configure do |config|
config.before(:suite) do
DatabaseCleaner.clean_with(:truncation)
end
config.before(:each) do
DatabaseCleaner.strategy = :transaction
end
# Transaction will block the js engive. You must use Truncation!
config.before(:each, :js => true) do
DatabaseCleaner.strategy = :truncation
end
config.before(:each) do
DatabaseCleaner.start
end
config.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