diff options
Diffstat (limited to 'activerecord/test/cases/associations')
-rw-r--r-- | activerecord/test/cases/associations/eager_test.rb | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/activerecord/test/cases/associations/eager_test.rb b/activerecord/test/cases/associations/eager_test.rb index 9c258b574f..b606092d7e 100644 --- a/activerecord/test/cases/associations/eager_test.rb +++ b/activerecord/test/cases/associations/eager_test.rb @@ -7,10 +7,13 @@ require 'models/category' require 'models/company' require 'models/person' require 'models/reader' +require 'models/owner' +require 'models/pet' class EagerAssociationTest < ActiveRecord::TestCase fixtures :posts, :comments, :authors, :categories, :categories_posts, - :companies, :accounts, :tags, :taggings, :people, :readers + :companies, :accounts, :tags, :taggings, :people, :readers, + :owners, :pets def test_loading_with_one_association posts = Post.find(:all, :include => :comments) @@ -73,6 +76,11 @@ class EagerAssociationTest < ActiveRecord::TestCase assert_nil Post.find(posts(:authorless).id, :include => :author).author end + def test_eager_association_loading_with_belongs_to_and_foreign_keys + pets = Pet.find(:all, :include => :owner) + assert_equal 3, pets.length + end + def test_eager_association_loading_with_belongs_to comments = Comment.find(:all, :include => :post) assert_equal 10, comments.length |