[rspec-users] cleaner failure messages?

David Chelimsky dchelimsky at gmail.com
Sat Jun 19 17:17:07 EDT 2010


On Jun 19, 2010, at 3:54 PM, rogerdpack wrote:

> 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.

Already done in rspec-2. Likely won't backport it to rspec-1 for some time (if ever).

Cheers,
David


More information about the rspec-users mailing list