Created
          March 8, 2018 13:04 
        
      - 
      
- 
        Save chris-roerig/bd5853d1e358457c10bf0af265529cdf to your computer and use it in GitHub Desktop. 
    DatabaseCleaner rails_helper config
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | RSpec.configure do |config| | |
| config.use_transactional_fixtures = false | |
| # Use transactions by default | |
| config.before :each do | |
| DatabaseCleaner.strategy = :transaction | |
| end | |
| # For the javascript-enabled tests, switch to truncation, but *only on tables that were used* | |
| config.before :each, :js => true do | |
| DatabaseCleaner.strategy = :truncation, {:pre_count => true} | |
| 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