Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RAILS_ENV deprecated #328

Closed
turadg opened this issue Feb 20, 2011 · 1 comment
Closed

RAILS_ENV deprecated #328

turadg opened this issue Feb 20, 2011 · 1 comment

Comments

@turadg
Copy link

turadg commented Feb 20, 2011

I'm using rails (3.0.4) and rspec-rails (2.5.0). When I run rails generate rspec:install it produces spec_helper.rb that contains this line:

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

When I run rake spec I get this warning on in the terminal:

DEPRECATION WARNING: RAILS_ENV is deprecated. Please use ::Rails.env.

One would be tempted to simply replace the ENV in spec_helper.rb with ::Rails.env but (e.g. solution on Stack Overflow ) but Rails.env returns "development" at that point so the line has no effect and leaves tests running in the development environment.

@dchelimsky
Copy link
Contributor

That warning is telling you that the constant RAILS_ENV is deprecated, not the the environment variable ENV["RAILS_ENV"]. If you clone the Rails repo and check out the v3.0.4 tag, and search for RAILS_ENV, you'll see that Rails, itself, uses ENV["RAILS_ENV"] in several places.

Must be coming from somewhere else in your app.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants