Skip to content
This repository

rake spec not loading RAILS_ENV=test #7227

Closed
krsmurata opened this Issue August 01, 2012 · 3 comments

2 participants

Kristopher Murata Carlos Antonio da Silva
Kristopher Murata

First, I don't know if it's a Rails issue or an RSpec problem, I'm posting here because I found the commit on Rails that introduced this new behavior or bug.

I'm used to just run: rake or rake spec to run the tests, running every time the tasks necessary for the test environment.

But, right now, with Rails 3.2.7 when running rake spec it doesn't set the RAILS_ENV to test, throwing some errors because it doesn't include the necessary list for the test env.

So, we have to either set the RAILS_ENV explicit to "test" before rake spec or use rspec spec/ and run db:prepare manually.

The commit I mentioned that introduced this was: caironoleto@f8df3f3

Environment:

Rails 3.2.7
ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-darwin11.4.0]

Carlos Antonio da Silva

Thanks for reporting.

This has already been reported in #7175 and solved in the 3-2-stable branch. When 3.2.8 comes out (soon I believe), it's going to be working fine, meanwhile you can either not use rake spec (use rspec), change ENV["RAILS_ENV"] ||= "test" to ENV["RAILS_ENV"] = "test" in your spec_helper, go back to 3.2.6 or bundle from 3-2-stable branch (or always set RAILS_ENV as you mentioned).

Carlos Antonio da Silva carlosantoniodasilva closed this August 01, 2012
Kristopher Murata

Sorry for that, I didn't find it because it was closed.

Thanks @carlosantoniodasilva :)

Carlos Antonio da Silva

No problem! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.