Skip to content

Loading…

== matcher fails with empty Diff #122

Closed
tvdeyen opened this Issue · 7 comments

2 participants

@tvdeyen

I expect two Objects to be the same with == matcher

ObjectA == ObjectA

RSpec fails with:

expected: #<ObjectA>
     got: #<ObjectA> (using ==)
    Diff:

Diff is empty? Why does it fail then?

@dchelimsky
RSpec member

What happens if you say (ObjectA == ObjectA).should be_true?

@tvdeyen

Hmm, they are, kind of:

assigns(:contact).should == AlchemyCrm::Contact.fake
def self.fake
    new(
        :salutation => 'mr',
        :title => 'Dr.',
        :firstname => 'Max',
        :lastname => 'Mustermann',
        :email => 'max@mustermann.de',
        :phone => '040-1234567',
        :mobile => '0171-1234567',
        :address => 'Lange Straße 10',
        :zip => '20000',
        :city => 'Hamburg',
        :organisation => 'Musterfirma',
        :country => 'DE'
    )
end

But then I can't match with be_a_new then, or?

@dchelimsky
RSpec member

You can try it, but I'm closing this because this is not rspec's issue. If you want help figuring out how to address this please write to the rspec-users list.

@dchelimsky dchelimsky closed this
@tvdeyen

Ok, but maybe rspec should show a better error, then Diff: (empty) so one knows whats the problem.

@dchelimsky
RSpec member

That tells you the problem! The problem is the objects say they are not equal, but there are no diffs between them.

@dchelimsky
RSpec member

But I'd consider it :) Feel free to file a separate feature request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.