tags:

views:

58

answers:

1
+1  Q: 

Rspec equal method

From what I have understood, the equal method checks if the object is the same.

person = Person.create!(:name => "David")
Person.find_by_name("David").should equal(person)

This should be true.

But aren't there two different objects here?

How could two objects be the same? I don't understand that.

+1  A: 

equal checks if the reference is the same. It corresponds to the Object#equal? method. You want to use == to compare these objects.

Marc-André Lafortune