aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/associations/eager_test.rb
diff options
context:
space:
mode:
authorJon Leighton <j@jonathanleighton.com>2010-10-13 11:56:15 +0100
committerAaron Patterson <aaron.patterson@gmail.com>2010-10-13 08:24:19 -0700
commit076b75bf9897cd06d3f849aba36dff65e12940ca (patch)
tree56a47ceb21a46a6ebaa61c33abe6af130502e170 /activerecord/test/cases/associations/eager_test.rb
parent603406dc53b656f7f317fe2ac6c4bac616a86368 (diff)
downloadrails-076b75bf9897cd06d3f849aba36dff65e12940ca.tar.gz
rails-076b75bf9897cd06d3f849aba36dff65e12940ca.tar.bz2
rails-076b75bf9897cd06d3f849aba36dff65e12940ca.zip
Add some tests for functionality in JoinAssociation which already exists but was previously untested
Diffstat (limited to 'activerecord/test/cases/associations/eager_test.rb')
-rw-r--r--activerecord/test/cases/associations/eager_test.rb8
1 files changed, 4 insertions, 4 deletions
diff --git a/activerecord/test/cases/associations/eager_test.rb b/activerecord/test/cases/associations/eager_test.rb
index 40859d425f..2d8e02e398 100644
--- a/activerecord/test/cases/associations/eager_test.rb
+++ b/activerecord/test/cases/associations/eager_test.rb
@@ -174,7 +174,7 @@ class EagerAssociationTest < ActiveRecord::TestCase
def test_eager_association_loading_with_belongs_to
comments = Comment.find(:all, :include => :post)
- assert_equal 10, comments.length
+ assert_equal 11, comments.length
titles = comments.map { |c| c.post.title }
assert titles.include?(posts(:welcome).title)
assert titles.include?(posts(:sti_post_and_comments).title)
@@ -532,7 +532,7 @@ class EagerAssociationTest < ActiveRecord::TestCase
def test_eager_has_many_with_association_inheritance
post = Post.find(4, :include => [ :special_comments ])
post.special_comments.each do |special_comment|
- assert_equal "SpecialComment", special_comment.class.to_s
+ assert special_comment.is_a?(SpecialComment)
end
end
@@ -726,8 +726,8 @@ class EagerAssociationTest < ActiveRecord::TestCase
posts = assert_queries(2) do
Post.find(:all, :joins => :comments, :include => :author, :order => 'comments.id DESC')
end
- assert_equal posts(:eager_other), posts[0]
- assert_equal authors(:mary), assert_no_queries { posts[0].author}
+ assert_equal posts(:eager_other), posts[1]
+ assert_equal authors(:mary), assert_no_queries { posts[1].author}
end
def test_eager_loading_with_conditions_on_joined_table_preloads