title: Spork, RSpec and database_cleaner destroying development database
body: <p>I have the following spec_helper.rb file in my Rails 3.1 application.  I am using Spork to load the environment faster for testing.  All my tests worked prior to adding Spork to the mix.  After adding spork, the test database was not getting properly cleared between test runs which threw off some of my expectations.</p>
  
  <p>Following other instructions, I added database_cleaner to the mix with the code listed below; however, now, the development database is getting cleaned up as well as the test database.  The ENV["RAILS_ENV"] call is returning test during this call.</p>
  
  <p>Is there a way to explicitly limit the call for DatabaseCleaner.clean_with(:truncation) to only affect the test database?</p>
  
  <pre><code>require 'rubygems'
  require 'spork'
  
  Spork.prefork do
    ENV["RAILS_ENV"] ||= 'test'
    require File.expand_path("../../config/environment", __FILE__)
    require 'rspec/rails'
    require 'shoulda/matchers/integrations/rspec'
    require 'database_cleaner'
  
    Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f}
  
    RSpec.configure do |config|
      config.mock_with :mocha
  
      config.formatter = 'documentation'
      config.use_transactional_fixtures = true
  
      config.before(:suite) do
        DatabaseCleaner.strategy = :truncation
      end
  
      config.before(:each) do
        DatabaseCleaner.start
      end
  
      config.after(:each) do
        DatabaseCleaner.clean
      end
    end
  end
  
  Spork.each_run do
    FactoryGirl.reload
  end
  </code></pre>
  
  <p>Update: Here is my database.yml file</p>
  
  <pre><code>development:
    adapter: sqlite3
    database: db/development.sqlite3
    pool: 5
    timeout: 5000
  
  test:
    adapter: sqlite3
    database: db/test.sqlite3
    pool: 5
    timeout: 5000
  
  production:
    adapter: sqlite3
    database: db/production.sqlite3
    pool: 5
    timeout: 5000
  </code></pre>
  
  <p>Also, I have worked around the basic problem by moving the clean_with call into the before(:each) section, but this slows down the test runs significantly.</p>