Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
require 'active_record'
require 'database_cleaner'
require 'yaml'
connection_info = YAML.load(ERB.new(File.read("config/database.yml")).result)["test"]
ActiveRecord::Base.establish_connection(connection_info)
RSpec.configure do |config|
config.before(:suite) do
DatabaseCleaner.strategy = :transaction
DatabaseCleaner.clean_with(: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
You can’t perform that action at this time.