mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Ensure that the comparison between 'CollectionProxy' and 'AssociationRelation' is consistent.
This commit is contained in:
parent
24052f925f
commit
783982ab2d
1 changed files with 9 additions and 0 deletions
|
@ -577,6 +577,15 @@ class BasicsTest < ActiveRecord::TestCase
|
|||
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
|
||||
|
|
Loading…
Reference in a new issue