diff options
Diffstat (limited to 'activerecord/test/associations_join_model_test.rb')
-rw-r--r-- | activerecord/test/associations_join_model_test.rb | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/activerecord/test/associations_join_model_test.rb b/activerecord/test/associations_join_model_test.rb index 61488900d6..5437e049a3 100644 --- a/activerecord/test/associations_join_model_test.rb +++ b/activerecord/test/associations_join_model_test.rb @@ -26,6 +26,10 @@ class AssociationsJoinModelTest < Test::Unit::TestCase def test_polymorphic_has_many assert_equal taggings(:welcome_general), posts(:welcome).taggings.first end + + def test_polymorphic_has_one + assert_equal taggings(:welcome_general), posts(:welcome).tagging + end def test_polymorphic_belongs_to assert_equal posts(:welcome), posts(:welcome).taggings.first.taggable @@ -46,7 +50,12 @@ class AssociationsJoinModelTest < Test::Unit::TestCase tagging = tags(:misc).taggings.create(:taggable => post) assert_equal "Post", tagging.taggable_type end - + + def test_polymorphic_has_one_create_model_with_inheritance + tagging = tags(:misc).create_tagging(:taggable => posts(:thinking)) + assert_equal "Post", tagging.taggable_type + end + def test_has_many_with_piggyback assert_equal "2", categories(:sti_test).authors.first.post_id.to_s end |