[rspec-devel] [ rspec-Feature Requests-7612 ] Add ENV['RAILS_ENV'] = 'test' at the top of spec_helper.rb

noreply at rubyforge.org noreply at rubyforge.org
Thu Jul 26 11:45:48 EDT 2007


Feature Requests item #7612, was opened at 2007-01-06 02:21
You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=3152&aid=7612&group_id=797

Category: rails plugin
Group: None
Status: Closed
Priority: 3
Submitted By: Brian Takita (btakita)
Assigned to: David Chelimsky (dchelimsky)
Summary: Add ENV['RAILS_ENV'] = 'test' at the top of spec_helper.rb

Initial Comment:
Otherwise, specs are run in development mode. Very confusing.

----------------------------------------------------------------------

Comment By: Peter Marklund (peter_marklund)
Date: 2007-07-26 17:45

Message:
I still have this problem, and I'm on the current stable release (I think it is 1.0.5). In spec_helper.rb we have:

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

which means that the environment for specs defaults to test if  RAILS_ENV isn't set and otherwise runs in whatever environment RAILS_ENV is set to. This meant for me that specs tried to run in development mode, which failed for some obscure reason. I run specs on my production server as well and I definetely don't want to run them in the production environment there... I think that just like in test_helper.rb the line should instead read:

ENV["RAILS_ENV"] = "test"

so that specs are always run in the test environment.

----------------------------------------------------------------------

Comment By: David Chelimsky (dchelimsky)
Date: 2007-01-06 03:20

Message:
This was fixed in the trunk some time ago (but after 0.7.5). Will be part of next release.

----------------------------------------------------------------------

You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=3152&aid=7612&group_id=797


More information about the rspec-devel mailing list