title: Database Cleaner: Clean vs truncation
body: <p>What is the difference between the following?</p>
  
  <ul>
  <li>DatabaseCleaner.clean_with(:truncation) </li>
  <li>DatabaseCleaner.clean</li>
  </ul>
  
  <p>What i'm trying to figure out is what is the best way to clean up a before(:all) hook in my tests (performance wise) using database cleaner. My before(:all) hook just creates a ton of factories and creates some associations between them. Currently, i'm just loading them all in a before(:each) not having to worry about the cleanup afterwards.</p>
  
  <p>My current strategy looks like:</p>
  
  <pre><code>RSpec.configure do |config|
    config.use_transactional_fixtures = false
  
    config.before(:suite) do
      DatabaseCleaner.clean_with(:truncation)
    end
  
    config.before(:each) do |example|
      DatabaseCleaner.strategy = example.metadata[:js] ? :truncation : :transaction
      DatabaseCleaner.start
    end
  
    config.after(:each) do
      DatabaseCleaner.clean
    end
  </code></pre>
  
  <p>So in addition to my previous question, what should my after(:all) look like?</p>