aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/type
diff options
context:
space:
mode:
authorSean Griffin <sean@thoughtbot.com>2014-11-19 11:24:18 -0800
committerSean Griffin <sean@thoughtbot.com>2014-11-19 11:24:35 -0800
commit74c35b46e362a128fe06f909744da8bb1aeed0e0 (patch)
tree8caf66a66736cc8c2a8fc9f89ef82637a744d9db /activerecord/test/cases/type
parente4300196721417237c3bfca0fc36313ea5ed7096 (diff)
downloadrails-74c35b46e362a128fe06f909744da8bb1aeed0e0.tar.gz
rails-74c35b46e362a128fe06f909744da8bb1aeed0e0.tar.bz2
rails-74c35b46e362a128fe06f909744da8bb1aeed0e0.zip
Introduce test to demonstrate regression caused by da99a2a2
Diffstat (limited to 'activerecord/test/cases/type')
-rw-r--r--activerecord/test/cases/type/type_map_test.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/activerecord/test/cases/type/type_map_test.rb b/activerecord/test/cases/type/type_map_test.rb
index 4e32f92dd0..81ac7394a8 100644
--- a/activerecord/test/cases/type/type_map_test.rb
+++ b/activerecord/test/cases/type/type_map_test.rb
@@ -124,6 +124,16 @@ module ActiveRecord
assert_equal mapping.lookup(3), 'string'
assert_kind_of Type::Value, mapping.lookup(4)
end
+
+ def test_aliases_are_not_improperly_cached
+ mapping = HashLookupTypeMap.new
+
+ mapping.register_type("foo") { |*args| args.join("-") }
+ mapping.alias_type("bar", "foo")
+
+ assert_equal "bar-1-2-3", mapping.lookup("bar", 1, 2, 3)
+ assert_equal "foo-1-2-3", mapping.lookup("foo", 1, 2, 3)
+ end
end
end
end