Skip to content
Browse files

Testing identity map on inherited active record classes. Distinct mod…

…els that use the same database table shouldn't be retrieved as the same object when there is not a type attribute.
  • Loading branch information...
1 parent 5e1960e commit 564922b32ceec259c442e965ac8a61ea5545bd48 @richardiux richardiux committed May 5, 2011
Showing with 17 additions and 0 deletions.
  1. +17 −0 activerecord/test/cases/identity_map_test.rb
View
17 activerecord/test/cases/identity_map_test.rb
@@ -129,6 +129,23 @@ def test_creation
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 #
##############################################################################

0 comments on commit 564922b

Please sign in to comment.
Something went wrong with that request. Please try again.