Skip to content

Commit

Permalink
Fix a test of AR::Type::TypeMap#lookup when using Oracle
Browse files Browse the repository at this point in the history
  • Loading branch information
koic committed Feb 2, 2017
1 parent 65bf1c6 commit 15bb36f
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions activerecord/test/cases/connection_adapters/type_lookup_test.rb
Expand Up @@ -89,12 +89,20 @@ def test_bigint_limit
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)

assert_equal :decimal, cast_type.type
assert_equal 2, cast_type.cast(2.1)
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 expected_type, cast_type.type
assert_equal 2, cast_type.cast(2.1)
end
end
end

Expand Down

0 comments on commit 15bb36f

Please sign in to comment.