[rspec-users] Nicer failure message formatting

Wincent Colaiuta win at wincent.com
Thu Jul 5 04:28:22 EDT 2007

El 22/6/2007, a las 15:34, Wincent Colaiuta escribió:

> El 22/6/2007, a las 14:36, Tom Locke escribió:
>> Easier to read:
>> expected:
>> "this is a very long string blah blah"
>> got:
>> "this is a very very long string blah blah"
>> (using ==)
>> Comments?
> For me even easier to read would be:
> expected: "this is a very long string blah blah"
> got     : "this is a very very long string blah blah"
> (using ==)

I've whipped up a patch for this against the current trunk (r2153). I  
was sick of seeing output like this:


Now I see output like this:


So for really short strings ("foo" vs "bar") readability is about the  
same, and for longer strings like the ones in the linked examples the  
readability is much improved. For *really* long strings (which wrap  
over multiple lines) readability in the console still sucks. You can  
see this for yourself by resizing your browser window to see how  
readability goes down as soon as wrapping starts to take place.

But this is still a big improvement. If you run your specs from  
inside TextMate then even long strings are much more readable,  
because SpecMate doesn't perform soft wrapping of long lines when  
showing diffs.

Pasting the diff here:


Will also try submitting via RubyForge, but I have a lot of troubling  
logging in thanks to the transparent proxy imposed by my ISP... :-(


More information about the rspec-users mailing list