We are porting a Rails 3 project to Rails 4. Our tests run fine under Rails 3, environment is correctly defaulted to test. However, when I switch over to my Rails 4 project and run the tests the same way...
rake test:controllers
My tests are running under development environment, wipes my dev db and output goes to development.log. I can not figure out the difference.
In my test_helper.rb I have this line...
ENV["RAILS_ENV"] = "test"
I've even tried...
Rails.env = "test"
and that does not work either.
Strange thing is, I have these puts in my test...
puts "#{__method__} Rails.env: #{Rails.env}"
puts "#{__method__} ENV[RAILS_ENV]: #{ENV["RAILS_ENV"]}"
and they both correctly show that I am in the "test" environment.
If I prefix RAILS_ENV=test before the rake test:controllers, all is well, but I should not have to do that.
Thank you
Aucun commentaire:
Enregistrer un commentaire