rspec-expectations: If == matcher fails with empty Diff, error notice should be more helpful.

Comparing two objects via == that are not equal, but have no differences make rspec fail. The error notice shown is:

Diff:

It would be helpful if an explanation of what’s the problem shows up. Like the comparing with eq notice!

About this issue

  • Original URL
  • State: closed
  • Created 12 years ago
  • Comments: 33 (15 by maintainers)

Commits related to this issue

Most upvoted comments

Why it fails. 😉

Please read this again with a 100000 miles perspective:

Expected A Got A Diff

What should this mean? Whats the failure?

If one expects that A equals A and it fails with: “Hey you expected A but got A with a difference of none” its not very helpful, isn’t it? 😉

I think a little bit more explaination would be helpful.

Using == we get this:

    Failure/Error: pessimist.should == pessimist
      expected: #<Pessimist:0x007f8d9c1e3508>
           got: #<Pessimist:0x007f8d9c1e3508> (using ==)
      Diff:

Using eq we get this:


    Failure/Error: pessimist.should eq(pessimist)

      expected: #<Pessimist:0x007fab988ef3a0>
           got: #<Pessimist:0x007fab988ef3a0>

      (compared using ==)

      Diff:

These have the same information, just formatted differently. What is it that you would like to see?


Reply to this email directly or view it on GitHub: https://github.com/rspec/rspec-expectations/issues/123#issuecomment-4538217