"rake test" wipes my development database

When I run “rake test”, I see the following in my development.log:
CREATE TABLE users etc

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?


P.S. This is on the latest 2-1-stable branch.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs