Rspec equal method

前端 未结 2 1375
自闭症患者
自闭症患者 2021-02-02 12:54

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\").sho         


        
2条回答
  •  星月不相逢
    2021-02-02 13:14

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

提交回复
热议问题