diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2014-05-20 17:23:42 -0300 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2014-05-20 17:23:42 -0300 |
commit | 53008447ecc17f67039dc7065af34ac25e7d6bc3 (patch) | |
tree | 579e3bcc85ca624c70ed48bff157b76dec6ea3c8 /activerecord/test/cases | |
parent | f3407d1392ed55aa4ff0a7d50ea6722f251c86ac (diff) | |
parent | ac4c1c3b0adabecdb1217594fed16db32b27ee9e (diff) | |
download | rails-53008447ecc17f67039dc7065af34ac25e7d6bc3.tar.gz rails-53008447ecc17f67039dc7065af34ac25e7d6bc3.tar.bz2 rails-53008447ecc17f67039dc7065af34ac25e7d6bc3.zip |
Merge pull request #15200 from sgrif/sg-type-map-mysql
Use the generic type map object for mysql field lookups
Diffstat (limited to 'activerecord/test/cases')
-rw-r--r-- | activerecord/test/cases/connection_adapters/type/type_map_test.rb | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/activerecord/test/cases/connection_adapters/type/type_map_test.rb b/activerecord/test/cases/connection_adapters/type/type_map_test.rb index 300c2ed225..4b4d9f6b0f 100644 --- a/activerecord/test/cases/connection_adapters/type/type_map_test.rb +++ b/activerecord/test/cases/connection_adapters/type/type_map_test.rb @@ -95,6 +95,19 @@ module ActiveRecord mapping.register_type(/only key/i) end end + + def test_lookup_non_strings + mapping = HashLookupTypeMap.new + + mapping.register_type(1, 'string') + mapping.register_type(2, 'int') + mapping.alias_type(3, 1) + + assert_equal mapping.lookup(1), 'string' + assert_equal mapping.lookup(2), 'int' + assert_equal mapping.lookup(3), 'string' + assert_kind_of Type::Value, mapping.lookup(4) + end end end end |