SHARE
TWEET

Untitled

a guest May 1st, 2016 228 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. RSpec.configure do |config|
  2.   current_db = Rails.configuration.database_configuration[Rails.env]
  3.  
  4.   config.before(:suite) do
  5.     ActiveRecord::Base.establish_connection DB_SECOND
  6.     DatabaseCleaner.strategy = :deletion
  7.     ActiveRecord::Base.establish_connection current_db
  8.     DatabaseCleaner.strategy = :deletion
  9.   end
  10.  
  11.   config.before(:each) do
  12.     ActiveRecord::Base.establish_connection DB_SECOND
  13.     DatabaseCleaner.start
  14.     ActiveRecord::Base.establish_connection current_db
  15.     DatabaseCleaner.start
  16.   end
  17.  
  18.   config.after(:each) do
  19.     ActiveRecord::Base.establish_connection DB_SECOND
  20.     DatabaseCleaner.clean_with :deletion
  21.     ActiveRecord::Base.establish_connection current_db
  22.     DatabaseCleaner.clean_with :deletion
  23.   end
  24. end
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top