Skip to content

Instantly share code, notes, and snippets.

@ushu
Last active December 30, 2015 09:19
Show Gist options
  • Save ushu/7808287 to your computer and use it in GitHub Desktop.
Save ushu/7808287 to your computer and use it in GitHub Desktop.
Rails: database_cleaner with rspec
# in spec/spec_helper
require 'database_cleaner'
# ...
RSpec.configure do |config|
config.before(:suite) do
DatabaseCleaner.strategy = :transaction
end
config.before(:each) do
DatabaseCleaner.start
end
config.after(:suite) do
DatabaseCleaner.clean
end
# ...
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment