Forum: Ruby on Rails RAILS_ENV changes to test after init

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
34c6f622fedc0d44d0e3dd43e22df67c?d=identicon&s=25 Nik B (Guest)
on 2008-12-10 14:40
(Received via mailing list)
I think RAILS_ENV is getting set incorrectly, but I don't know exactly
how to find out where.

At the bottom of Rails::Initializer.run do |config| in environment.rb,
RAILS_ENV is the correct value (staging, development, production,
etc).

Just below the initializer block, RAILS_ENV has changed to 'test'.

Any ideas?
34c6f622fedc0d44d0e3dd43e22df67c?d=identicon&s=25 Nik B (Guest)
on 2008-12-10 15:57
(Received via mailing list)
Turns out it was happening when rpsec-rails was being loaded.
Conditional loading for the test environment solved this:

config.gem 'rspec-rails', :lib => 'spec/rails', :version => '1.1.11'
if RAILS_ENV == 'test'
This topic is locked and can not be replied to.