mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Add a test case that eager-loading with a polymorphic association and using exists?
This test covers the case of02da8aea
. Previously `exists?` was always eager-loading the includes values. But now it is eager-loaded only when necessary since07a611e0
. So the case of the eager-loading had not covered in the test.
This commit is contained in:
parent
8877492df2
commit
300c68e939
1 changed files with 4 additions and 0 deletions
|
@ -1501,6 +1501,10 @@ class EagerAssociationTest < ActiveRecord::TestCase
|
|||
assert_equal posts(:welcome), post
|
||||
end
|
||||
|
||||
test "eager-loading with a polymorphic association and using the existential predicate" do
|
||||
assert_equal true, authors(:david).essays.eager_load(:writer).exists?
|
||||
end
|
||||
|
||||
# CollectionProxy#reader is expensive, so the preloader avoids calling it.
|
||||
test "preloading has_many_through association avoids calling association.reader" do
|
||||
ActiveRecord::Associations::HasManyAssociation.any_instance.expects(:reader).never
|
||||
|
|
Loading…
Reference in a new issue