I expect two Objects to be the same with == matcher
ObjectA == ObjectA
RSpec fails with:
got: #<ObjectA> (using ==)
Diff is empty? Why does it fail then?
What happens if you say (ObjectA == ObjectA).should be_true?
(ObjectA == ObjectA).should be_true
Also, do these objects happen to be new ActiveRecord models (i.e. AR models w/ no ID)? If so, see https://rails.lighthouseapp.com/projects/8994/tickets/1321-treat-new-records-with-equivalent-attributes-as-equivalent and use http://rubydoc.info/gems/rspec-rails/RSpec/Rails/Matchers:be_a_new.
Hmm, they are, kind of:
assigns(:contact).should == AlchemyCrm::Contact.fake
:salutation => 'mr',
:title => 'Dr.',
:firstname => 'Max',
:lastname => 'Mustermann',
:email => 'firstname.lastname@example.org',
:phone => '040-1234567',
:mobile => '0171-1234567',
:address => 'Lange Straße 10',
:zip => '20000',
:city => 'Hamburg',
:organisation => 'Musterfirma',
:country => 'DE'
But then I can't match with be_a_new then, or?
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.
Ok, but maybe rspec should show a better error, then Diff: (empty) so one knows whats the problem.
That tells you the problem! The problem is the objects say they are not equal, but there are no diffs between them.
But I'd consider it :) Feel free to file a separate feature request.