[rspec-users] cleaner failure messages?

rogerdpack rogerdpack at gmail.com
Sat Jun 19 16:54:58 EDT 2010


Hi all.
Sorry if this is an old request...

Currently when a failure is reported it looks like this:

C:\dev\ruby\faster_rubygems\spec>spec
spec.faster_rubygems_cacheing.rb
F

1)
RuntimeError in 'FasterRubyGems cacheing Gem.bin_path should cache and
reload Gem.bin_path where possible'
assertion failed
C:/dev/ruby/faster_rubygems/spec/spec.faster_rubygems_cacheing.rb:
14:in `block (3 levels) in <top (required)>'

This is good because it tells me what line failed, but that's about
it.

The skinny of this request is that I'd find it more useful to actually
have the code displayed that failed on line 14, in this case, the word
"fail"

so like this:
C:/dev/ruby/faster_rubygems/spec/spec.faster_rubygems_cacheing.rb:14:
"fail"
Instead of the current
C:/dev/ruby/faster_rubygems/spec/spec.faster_rubygems_cacheing.rb:
14:in `block (3 levels) in <top (required)>'

So the failure report is good, but could be improved.
Another option would be to display the line below what is currently
output, like

C:/dev/ruby/faster_rubygems/spec/spec.faster_rubygems_cacheing.rb:
14:in `block (3 levels) in <top (required)>'
  fail

Or something like that.
Any thoughts there?
Thanks.
-rp


More information about the rspec-users mailing list