[rspec-devel] [ rspec-Bugs-11467 ] rake aborted!

noreply at rubyforge.org noreply at rubyforge.org
Mon Jun 11 18:38:45 EDT 2007


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

>Category: None
Group: None
>Status: Closed
Resolution: Rejected
Priority: 3
Submitted By: Will Gray (graywh)
>Assigned to: Aslak Hellesøy (aslak_hellesoy)
Summary: rake aborted!

Initial Comment:
The specs run fine, but rake gives an error message after "X examples, N failure".

10 examples, 1 failure
rake aborted!
Command ruby -I"/home/graywh/src/rails/project/vendor/plugins/rspec/lib" "/home/graywh/src/rails/project/vendor/plugins/rspec/bin/spec" "spec/models/person_spec.rb" --options "/home/graywh/src/rails/project/config/../spec/spec.opts"  failed
/home/graywh/src/rails/project/vendor/plugins/rspec/lib/spec/rake/spectask.rb:132:in `define'
/usr/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:823:in `verbose'
/home/graywh/src/rails/project/vendor/plugins/rspec/lib/spec/rake/spectask.rb:106:in `define'
/usr/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:392:in `call'
/usr/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:392:in `execute'
/usr/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:392:in `each'
/usr/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:392:in `execute'
/usr/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:362:in `invoke'
/usr/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:355:in `synchronize'
/usr/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:355:in `invoke'
/usr/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:1739:in `top_level'
/usr/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:1739:in `each'
/usr/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:1739:in `top_level'
/usr/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:1761:in `standard_exception_handling'
/usr/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:1733:in `top_level'
/usr/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:1711:in `run'
/usr/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:1761:in `standard_exception_handling'
/usr/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:1708:in `run'
/usr/lib/ruby/gems/1.8/gems/rake-0.7.3/bin/rake:7
/usr/bin/rake:16:in `load'
/usr/bin/rake:16


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

>Comment By: Aslak Hellesøy (aslak_hellesoy)
Date: 2007-06-11 18:38

Message:
The purpose of reporting is for you to see *what* went wrong.

There are several reasons for aborting rake (by raising an error, which in turn causes rake to exit with a non-0 exit code):

1) Without an immediate failure, Rake might continue doing other things, outputting more text, and you might miss it unless you stare at the screen while Rake is running.
2) Automated tools (continuous integration etc) now have a way of knowing that something went wrong.
3) It's a mechanism to prevent more things from happening in Rake after the specs fail - there are several things that you might want *not* want to do when specs fail - such as tagging and releasing your product.

Aborting the build tool on one or more failures is standard practice in all build tools I've used: Make/gcc, Ant/JUnit, Ant/javac, Rake/test::unit etc...

The fail_on_error flag is documented in the Rake task's RDoc, which should be easy to find from RSpec's home page, http://rspec.rubyforge.org/ -> Documentation -> RDoc:

http://rspec.rubyforge.org/rdoc/index.html
http://rspec.rubyforge.org/rdoc/classes/Spec/Rake/SpecTask.html

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

Comment By: Will Gray (graywh)
Date: 2007-06-11 17:36

Message:
Then I find the double-reporting of failed specs confusing.
 Printing a message to stdout such as "109 examples, 2
failures" already tells me a spec failed.  Following that
with "rake aborted!  Command ... failed" made me think
something [other than a failed spec] went wrong.

How can I use the fail_on_error flag?

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

Comment By: Aslak Hellesøy (aslak_hellesoy)
Date: 2007-06-11 16:36

Message:
"When there is at least one failure, spec's exit status is 1.
 That causes system() to throw an exception at
rspec/lib/spec/rake/spectasks.rb:130 even though nothing
actually went wrong."

But something *did* go wrong. There was a failure in your specs, and that is wrong. Are you saying that you want Rake to always execute successfully, even when there are spec failures? How are we supposed to detect errors?

You can always set the fail_on_error flag if you want Rake to continue despite spec errors.

Or am I completely misunderstanding you? 

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

Comment By: Will Gray (graywh)
Date: 2007-06-11 13:42

Message:
When there is at least one failure, spec's exit status is 1.
 That causes system() to throw an exception at
rspec/lib/spec/rake/spectasks.rb:130 even though nothing
actually went wrong.

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

Comment By: Will Gray (graywh)
Date: 2007-06-11 10:18

Message:
I'm using the latest version from
svn://rubyforge.org/var/svn/rspec/tags/CURRENT/rspec_on_rails.

The problem only occurs when there is at least one failing
example.  It doesn't matter if I use 'rake spec', 'rake
spec:models', or 'rake spec SPEC=spec/models/my_model_spec.rb'.

Using 'script/spec' gives no errors.

My spec/spec.opts file contains the following options:
--colour
--format
specdoc
--loadby
mtime

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

Comment By: David Chelimsky (dchelimsky)
Date: 2007-06-08 17:27

Message:
Closing this because there is no information here that we can use to help you. Please feel free to re-open with version information plus some indication that it's an rspec problem. For example, if you do this:

script/spec spec

Do you get any weird errors?

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

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


More information about the rspec-devel mailing list