Topic: when I run tests it uses development database instead of test

I am just starting doing tests. I don't have rSpec or anything.

When I run 'rake test' my development database gets wiped and the data from the fixtures gets inserted. Both databases are fully migrated. The test database is always empty.

database.yml

development:
  adapter: sqlite3
  database: db/development.sqlite3
  pool: 5
  timeout: 5000

test:
  adapter: sqlite3
  database: db/test.sqlite3
  pool: 5
  timeout: 5000

I don't know what else to say, this is a complete mystery to me.

Re: when I run tests it uses development database instead of test

That is strange ... try rake test RAILS_ENV=test

Re: when I run tests it uses development database instead of test

Maybe you have environment explicitly set in environment.rb? In this case it always uses specified environment, no matter what...

Re: when I run tests it uses development database instead of test

Make sure you have:

ENV["RAILS_ENV"] ||= "test"

at the top of your env.rb file in features/support. If it was accidentally edited to say development instead of test, it would load your development database. If that does not work, I would do a project search for the term 'development' to make sure your not setting the development accidentally somewhere (maybe a rogue = where you meant to use ==).

Last edited by moger777 (2011-02-20 18:53:20)