aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/associations/nested_has_many_through_associations_test.rb
diff options
context:
space:
mode:
authorJon Leighton <j@jonathanleighton.com>2010-10-14 13:16:47 +0100
committerJon Leighton <j@jonathanleighton.com>2010-10-14 13:16:47 +0100
commit25acd19da5f75a425218740fbb187b18bbb060ce (patch)
treed3f02cbba97d3259463d81a2bd542cdeb58a6aad /activerecord/test/cases/associations/nested_has_many_through_associations_test.rb
parent7963c30ebaeb511f7ddacc99ae2c7a530059ae6b (diff)
downloadrails-25acd19da5f75a425218740fbb187b18bbb060ce.tar.gz
rails-25acd19da5f75a425218740fbb187b18bbb060ce.tar.bz2
rails-25acd19da5f75a425218740fbb187b18bbb060ce.zip
Add test_has_many_through_belongs_to_with_has_many_through_source_reflection (which already passes)
Diffstat (limited to 'activerecord/test/cases/associations/nested_has_many_through_associations_test.rb')
-rw-r--r--activerecord/test/cases/associations/nested_has_many_through_associations_test.rb13
1 files changed, 12 insertions, 1 deletions
diff --git a/activerecord/test/cases/associations/nested_has_many_through_associations_test.rb b/activerecord/test/cases/associations/nested_has_many_through_associations_test.rb
index 7e1fc60cb9..6212eed0eb 100644
--- a/activerecord/test/cases/associations/nested_has_many_through_associations_test.rb
+++ b/activerecord/test/cases/associations/nested_has_many_through_associations_test.rb
@@ -213,9 +213,20 @@ class NestedHasManyThroughAssociationsTest < ActiveRecord::TestCase
# assert_equal [tags(:general), tags(:general)], authors.first.tagging_tags
end
- # TODO: has_many through
+ # has_many through
# Source: has_many through
# Through: belongs_to
+ def test_has_many_through_belongs_to_with_has_many_through_source_reflection
+ assert_equal [taggings(:welcome_general), taggings(:thinking_general)],
+ categorizations(:david_welcome_general).post_taggings
+
+ categorizations = Categorization.joins(:post_taggings).where('taggings.id' => taggings(:welcome_general).id)
+ assert_equal [categorizations(:david_welcome_general)], categorizations
+
+ categorizations = Categorization.includes(:post_taggings)
+ assert_equal [taggings(:welcome_general), taggings(:thinking_general)],
+ categorizations.first.post_taggings
+ end
# has_one through
# Source: has_one through