[rspec-devel] [ rspec-Bugs-6629 ] Can't run integration tests with spec-ified rails app.

noreply at rubyforge.org noreply at rubyforge.org
Sun Nov 26 18:32:18 EST 2006


Bugs item #6629, was opened at 2006-11-11 15:32
You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=3149&aid=6629&group_id=797

Category: rails plugin
Group: None
Status: Open
Resolution: None
Priority: 3
Submitted By: David Chelimsky (dchelimsky)
Assigned to: Nobody (None)
Summary: Can't run integration tests with spec-ified rails app.

Initial Comment:
After installing 'spec/rails' in an app that has rails integration tests (in test/integration), running rake test does not run the tests:

$ rake test:integration
(in /Users/david/projects/ruby/rspec/trunk/vendor/rspec_on_rails)
/usr/local/bin/ruby -Ilib:test "/usr/local/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake/rake_test_loader.rb"
$




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

Comment By: Pat Maddox (pergesu)
Date: 2006-11-26 16:32

Message:
I'm not entirely sure what the problem is, as far as I can tell it has something to do with the rspec stuff getting loaded.  Rails unit and functional tests also aren't run - you might have used a generator that uses them.

My workaround was pretty simple.  I just added a flag to see if rspec shouldn't be loaded, which would be the case for unit/functional/integration.

In spec_helper.rb, after the RAILS_ENV declaration, add
ENV["NO_RSPEC"]  = nil

In test_helper.rb, after the RAILS_ENV declaration, add
ENV["NO_RSPEC"]  = "true"

And in rspec/init.rb, change the code to
if ENV['RAILS_ENV'] == 'test' && ENV['NO_RSPEC'].nil? then
  require 'rspec_on_rails'
end

Simple, works for me.  Running "rake" will run unit tests, functional tests, integration tests, model specs, controller specs, and then view specs.  Perfect for making sure that any generated code tests fine as well as your custom code.

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

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


More information about the rspec-devel mailing list