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?
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
differences.
– Elliot
On Sat, May 22, 2010 at 11:47 AM, Patrick J. Collins <
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.