aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/associations_join_model_test.rb
diff options
context:
space:
mode:
authorJamis Buck <jamis@37signals.com>2006-01-20 21:51:48 +0000
committerJamis Buck <jamis@37signals.com>2006-01-20 21:51:48 +0000
commitf9c13e6134bbc32dd826eec39fedba5de2514f88 (patch)
treef58cbeb77de93e1fa229b191b91e03913163770a /activerecord/test/associations_join_model_test.rb
parentd2f47503f8890fe42310ada8ca9408ac5f268265 (diff)
downloadrails-f9c13e6134bbc32dd826eec39fedba5de2514f88.tar.gz
rails-f9c13e6134bbc32dd826eec39fedba5de2514f88.tar.bz2
rails-f9c13e6134bbc32dd826eec39fedba5de2514f88.zip
Add a test to verify correct behavior when creating a polymorphic association
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3440 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/test/associations_join_model_test.rb')
-rw-r--r--activerecord/test/associations_join_model_test.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/activerecord/test/associations_join_model_test.rb b/activerecord/test/associations_join_model_test.rb
index f8d8b77813..a011a0fae8 100644
--- a/activerecord/test/associations_join_model_test.rb
+++ b/activerecord/test/associations_join_model_test.rb
@@ -39,6 +39,14 @@ class AssociationsJoinModelTest < Test::Unit::TestCase
assert_equal tags(:general), posts(:thinking).tags.first
end
+ def test_polymorphic_has_many_create_model_with_inheritance
+ post = posts(:thinking)
+ assert_instance_of SpecialPost, post
+
+ tagging = tags(:misc).taggings.create(:taggable => post)
+ 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