Guest User

Untitled

a guest
Apr 19th, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. def <=> other
  2. self.id <=> other.id
  3. end
  4.  
  5.  
  6. ## This is the warning I get
  7. context "House comparison" do
  8. setup do
  9. @house1 = House.new
  10. @house2 = House.new
  11. end
  12.  
  13. should "be identical if they have identical ids" do
  14. @house1.id = 1
  15. @house2.id = 1
  16. assert @house1 == @house2
  17. end
  18.  
  19. should "be less than another house with a lower house id" do
  20. @house1.id = 1
  21. @house2.id = 2
  22. assert @house1 < @house2
  23. end
  24.  
  25. should "be greater than another house with a lower house id" do
  26. @house1.id = 2
  27. @house2.id = 1
  28. assert @house1 > @house2
  29. end
  30. end
  31.  
  32. ## The warning I get
  33. warning: Object#id will be deprecated; use Object#object_id
Add Comment
Please, Sign In to add comment