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

noreply at rubyforge.org noreply at rubyforge.org
Mon Aug 27 16:39:09 EDT 2007


Bugs item #13437, was opened at 2007-08-27 19: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: Closed
>Resolution: Out of Date
Priority: 3
Submitted By: Jay Levitt (jaylev)
>Assigned to: David Chelimsky (dchelimsky)
>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?

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

>Comment By: David Chelimsky (dchelimsky)
Date: 2007-08-27 20:39

Message:
This was fixed a few releases back. Make sure to follow all the upgrade directions on http://rspec.rubyforge.org/upgrade.html, including running:

script/generate rspec

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

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