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:
parent
4277047018
commit
0eaecdb7b8
1 changed files with 13 additions and 5 deletions
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in a new issue