[rspec-users] customize output of script/spec?

Elliot Winkler elliot.winkler at gmail.com
Sat May 22 16:22:46 EDT 2010

I don't think RSpec has a built-in way to customize that. I think you'll
just have to override the matcher you're using. Clone the git repo (or, `gem
install open_gem` and then `gem open rspec`) and take a look at the
spec/matchers/* directory for more (note that `.should ==`, `.should_not ==`
is OperatorMatcher and not EqualMatcher).

As for detecting the differences, you could check out one of these solutions
[1], and then use the ansi-termcolor or colored gems to colorize the

-- Elliot

[1]: http://stackoverflow.com/questions/80091/diff-a-ruby-string-or-array

On Sat, May 22, 2010 at 11:47 AM, Patrick J. Collins <
patrick at collinatorstudios.com> wrote:

> Hi,
> I am just curious-- is there any way to customize the output of the
> "expect",
> "got" that is returned?
> I often find myself comparing big blocks of text that are virtually
> identical
> except one minor detail (like a missing letter somewhere), and it's quite
> hard
> to tell what is different between the expected and got..
> Is there perhaps a way to make it so that the actual differences have a
> different foreground or background color in the terminal?
> Thanks.
> Patrick J. Collins
> http://collinatorstudios.com
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20100522/3d5f1670/attachment.html>

More information about the rspec-users mailing list