Permalink
Browse files

Ensure that the comparison between 'CollectionProxy' and 'Association…

…Relation' is consistent.
  • Loading branch information...
1 parent 24052f9 commit 783982ab2df7a65e97d098ac1ab624436eb7c278 @laurocaetano laurocaetano committed Apr 11, 2014
Showing with 9 additions and 0 deletions.
  1. +9 −0 activerecord/test/cases/base_test.rb
@@ -577,6 +577,15 @@ def test_equality_of_relation_and_association_relation
assert_equal car.bulbs.includes(:car), Bulb.where(car_id: car.id), 'AssociationRelation should be comparable with Relation'
end
+ def test_equality_of_collection_proxy_and_association_relation
+ car = Car.create!
+ car.bulbs.build
+ car.save
+
+ assert_equal car.bulbs, car.bulbs.includes(:car), 'CollectionProxy should be comparable with AssociationRelation'
+ assert_equal car.bulbs.includes(:car), car.bulbs, 'AssociationRelation should be comparable with CollectionProxy'
+ end
+
def test_hashing
assert_equal [ Topic.find(1) ], [ Topic.find(2).topic ] & [ Topic.find(1) ]
end

0 comments on commit 783982a

Please sign in to comment.