Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

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

…Relation' is consistent.
  • Loading branch information...
commit 783982ab2df7a65e97d098ac1ab624436eb7c278 1 parent 24052f9
@laurocaetano laurocaetano authored
Showing with 9 additions and 0 deletions.
  1. +9 −0 activerecord/test/cases/base_test.rb
View
9 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
Please sign in to comment.
Something went wrong with that request. Please try again.