diff options
author | Richard Millan <richardiux@gmail.com> | 2011-05-05 04:52:42 -0700 |
---|---|---|
committer | Richard Millan <richardiux@gmail.com> | 2011-05-05 04:52:42 -0700 |
commit | 564922b32ceec259c442e965ac8a61ea5545bd48 (patch) | |
tree | 5019ffc4b4797e98bb57bc9df4ad780ec9ae2f7a /activerecord/test | |
parent | 5e1960ea200274ec2157f5fae1c91ee722b56498 (diff) | |
download | rails-564922b32ceec259c442e965ac8a61ea5545bd48.tar.gz rails-564922b32ceec259c442e965ac8a61ea5545bd48.tar.bz2 rails-564922b32ceec259c442e965ac8a61ea5545bd48.zip |
Testing identity map on inherited active record classes. Distinct models that use the same database table shouldn't be retrieved as the same object when there is not a type attribute.
Diffstat (limited to 'activerecord/test')
-rw-r--r-- | activerecord/test/cases/identity_map_test.rb | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/activerecord/test/cases/identity_map_test.rb b/activerecord/test/cases/identity_map_test.rb index 649715fbb5..6cd29ed5b4 100644 --- a/activerecord/test/cases/identity_map_test.rb +++ b/activerecord/test/cases/identity_map_test.rb @@ -129,6 +129,23 @@ class IdentityMapTest < ActiveRecord::TestCase end ############################################################################## + # Tests checking if IM is functioning properly on classes with multiple # + # types of inheritance # + ############################################################################## + + def test_inherited_without_type_attribute + p1 = DestructivePirate.create!(:catchphrase => "I'm not a regular Pirate") + p2 = Pirate.find(p1.id) + assert_not_same(p1, p2) + end + + def test_inherited_with_type_attribute + c1 = comments(:sub_special_comment) + c2 = Comment.find(c1.id) + assert_same(c1, c2) + end + + ############################################################################## # Tests checking dirty attribute behaviour with IM # ############################################################################## |