[rspec-devel] [ rspec-Bugs-13437 ] "rake spec" always runs in development mode

noreply at rubyforge.org noreply at rubyforge.org
Mon Aug 27 15:54:27 EDT 2007


Bugs item #13437, was opened at 2007-08-27 15:54
You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=3149&aid=13437&group_id=797

Category: rails plugin
Group: None
Status: Open
Resolution: None
Priority: 3
Submitted By: Jay Levitt (jaylev)
Assigned to: Nobody (None)
Summary: "rake spec" always runs in development mode

Initial Comment:

"rake spec" runs in development mode, not test!

railties/helpers/test_helper.rb has the line:
  ENV["RAILS_ENV"] = "test"

But #{MYAPP}/spec/spec_helper.rb has:
  ENV["RAILS_ENV"] ||= "test"

A little flexibility is always good, right?  Not really.  Because the first line of a Rails Rakefile is:
  require(File.join(File.dirname(__FILE__), 'config', 'boot'))

And that ends up calling railties/lib/initializer.rb, which says:
  RAILS_ENV = (ENV['RAILS_ENV'] || 'development').dup unless 
    defined?(RAILS_ENV)

So spec_helper.rb -always- has RAILS_ENV predefined when running under Rake.

I'd assume the solution is to change spec_helper.rb to act like test_helper.rb and always set RAILS_ENV, but if that affects someone else's non-Rake workflow, maybe there's a better way?

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

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


More information about the rspec-devel mailing list