[rspec-users] JSON matcher

Phlip phlip2005 at gmail.com
Mon Apr 6 22:22:52 EDT 2009

Michael Schuerig wrote:

>       def failure_message
>         "expected\n#{@raw_target}\n" +
>         "to be JSON code equivalent to\n#{@raw_expected}\n" +
>         "Difference:\n#{@expected.diff(@target).inspect}"
>       end

Nice - this fixes the common problem with assertions on large bulky variables - 
they often leave you squinting, trying to see the line that's different.

But where did .diff() come from? should I know it's part of ActiveSupport::JSON 
or something?

More information about the rspec-users mailing list