1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Merge pull request #27881 from koic/fix_test_type_map_lookup_using_oracle

Fix a test of AR::Type::TypeMap#lookup when using Oracle
This commit is contained in:
Eileen M. Uchitelle 2017-02-03 08:37:07 -05:00 committed by eileencodes
parent 4277047018
commit 0eaecdb7b8

View file

@ -89,12 +89,20 @@ module ActiveRecord
end
def test_decimal_without_scale
types = %w{decimal(2) decimal(2,0) numeric(2) numeric(2,0) number(2) number(2,0)}
types.each do |type|
cast_type = @connection.type_map.lookup(type)
if current_adapter?(:OracleAdapter)
{
decimal: %w{decimal(2) decimal(2,0) numeric(2) numeric(2,0)},
integer: %w{number(2) number(2,0)}
}
else
{ decimal: %w{decimal(2) decimal(2,0) numeric(2) numeric(2,0) number(2) number(2,0)} }
end.each do |expected_type, types|
types.each do |type|
cast_type = @connection.type_map.lookup(type)
assert_equal :decimal, cast_type.type
assert_equal 2, cast_type.cast(2.1)
assert_equal expected_type, cast_type.type
assert_equal 2, cast_type.cast(2.1)
end
end
end