Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add failing test for preloading with a polymorphic association and us…

…ing the existential predicate
  • Loading branch information...
commit e562ddedbae5d44cc98ada8a597fd84e80aea96d 1 parent 6935075
@dhh dhh authored
Showing with 10 additions and 1 deletion.
  1. +10 −1 activerecord/test/cases/associations/eager_test.rb
View
11 activerecord/test/cases/associations/eager_test.rb
@@ -4,6 +4,7 @@
require 'models/tag'
require 'models/comment'
require 'models/author'
+require 'models/essay'
require 'models/category'
require 'models/company'
require 'models/person'
@@ -24,7 +25,7 @@
require 'models/sponsor'
class EagerAssociationTest < ActiveRecord::TestCase
- fixtures :posts, :comments, :authors, :author_addresses, :categories, :categories_posts,
+ fixtures :posts, :comments, :authors, :essays, :author_addresses, :categories, :categories_posts,
:companies, :accounts, :tags, :taggings, :people, :readers, :categorizations,
:owners, :pets, :author_favorites, :jobs, :references, :subscribers, :subscriptions, :books,
:developers, :projects, :developers_projects, :members, :memberships, :clubs, :sponsors
@@ -1185,4 +1186,12 @@ def test_deep_including_through_habtm
author = Author.includes(:posts).references(:posts).reorder(:name).find_by('posts.title IS NOT NULL')
assert_equal authors(:bob), author
end
+
+ test "preloading with a polymorphic association and using the existential predicate" do
+ assert_equal authors(:david), authors(:david).essays.includes(:writer).first.writer
+
+ assert_nothing_raised do
+ authors(:david).essays.includes(:writer).any?
+ end
+ end
end
Please sign in to comment.
Something went wrong with that request. Please try again.