t56k
t56k

Reputation: 7011

DatabaseCleaner cleans test and development?

Why does this configuration seem to clean both my test and my development databases? It's pretty annoying to have to reseed development every time I run rspec.

config.before(:suite) do
  DatabaseCleaner.strategy = :transaction
  DatabaseCleaner.clean_with(:truncation)
end

database.yml

development:
  adapter: postgresql
  database: m_development
  encoding: utf8
  pool: 5
  username: booltox
  password:

test:
  adapter: postgresql
  database: m_test
  encoding: utf8
  pool: 5
  username: booltox
  password:

Upvotes: 2

Views: 335

Answers (1)

t56k
t56k

Reputation: 7011

Pretty foolish of me but this might help someone else. Don't forget to define your environment in your spec_helper.rb (thanks @dgilperez):

ENV['RAILS_ENV'] ||= 'test'

Upvotes: 1

Related Questions