aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/identity_map_test.rb
diff options
context:
space:
mode:
authorRichard Millan <richardiux@gmail.com>2011-05-05 07:28:51 -0700
committerRichard Millan <richardiux@gmail.com>2011-05-05 07:28:51 -0700
commitd53b406a76db291f9d1ef15685f87a0977f16c89 (patch)
tree5da213b91f4b46f7f5c41725b06ce7562178864f /activerecord/test/cases/identity_map_test.rb
parent564922b32ceec259c442e965ac8a61ea5545bd48 (diff)
downloadrails-d53b406a76db291f9d1ef15685f87a0977f16c89.tar.gz
rails-d53b406a76db291f9d1ef15685f87a0977f16c89.tar.bz2
rails-d53b406a76db291f9d1ef15685f87a0977f16c89.zip
Test: identity on inherited classes should behave the same when turned on or off
Diffstat (limited to 'activerecord/test/cases/identity_map_test.rb')
-rw-r--r--activerecord/test/cases/identity_map_test.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/activerecord/test/cases/identity_map_test.rb b/activerecord/test/cases/identity_map_test.rb
index 6cd29ed5b4..c183690187 100644
--- a/activerecord/test/cases/identity_map_test.rb
+++ b/activerecord/test/cases/identity_map_test.rb
@@ -133,6 +133,22 @@ class IdentityMapTest < ActiveRecord::TestCase
# types of inheritance #
##############################################################################
+ def test_inherited_without_type_attribute_without_identity_map
+ ActiveRecord::IdentityMap.without do
+ p1 = DestructivePirate.create!(:catchphrase => "I'm not a regular Pirate")
+ p2 = Pirate.find(p1.id)
+ assert_not_same(p1, p2)
+ end
+ end
+
+ def test_inherited_with_type_attribute_without_identity_map
+ ActiveRecord::IdentityMap.without do
+ c1 = comments(:sub_special_comment)
+ c2 = Comment.find(c1.id)
+ assert_same(c1.class, c2.class)
+ end
+ end
+
def test_inherited_without_type_attribute
p1 = DestructivePirate.create!(:catchphrase => "I'm not a regular Pirate")
p2 = Pirate.find(p1.id)