When I run “rake test”, I see the following in my development.log:
Sure enough, when I check my development database, all the data is
gone! But strangely, the test fixtures are loaded into the test
database, not the development database.
In my database.yml, the production and test databases are clearly set
to be different, so that’s not the reason.
I’m not setting RAILS_ENV in the environment I’m running “rake test”
from, nor is it set to development in any of my config files:
$ find . | xargs grep RAILS_ENV
./config/environment.rb:# ENV[‘RAILS_ENV’] ||= ‘production’
./test/test_helper.rb:ENV[“RAILS_ENV”] = “test”
If I run “RAILS_ENV=test rake test” then everything works correctly –
the development database is not wiped. But surely “rake test” should
use the test environment automatically?
Any ideas? Or at least ideas on where to look?