Permalink
Browse files

fix schema_dumper_test for Oracle as it supports precision up to 38

  • Loading branch information...
1 parent 94e7615 commit 9b2309c4a8a8c8ad46658c170ccfdb828b30c443 @rsim rsim committed Jun 5, 2009
Showing with 12 additions and 2 deletions.
  1. +6 −1 activerecord/test/cases/schema_dumper_test.rb
  2. +6 −1 activerecord/test/schema/schema.rb
@@ -198,6 +198,11 @@ def test_schema_dump_includes_decimal_options
def test_schema_dump_keeps_large_precision_integer_columns_as_decimal
output = standard_dump
- assert_match %r{t.decimal\s+"atoms_in_universe",\s+:precision => 55,\s+:scale => 0}, output
+ # Oracle supports precision up to 38 and it identifies decimals with scale 0 as integers
+ if current_adapter?(:OracleAdapter)
+ assert_match %r{t.integer\s+"atoms_in_universe",\s+:precision => 38,\s+:scale => 0}, output
+ else
+ assert_match %r{t.decimal\s+"atoms_in_universe",\s+:precision => 55,\s+:scale => 0}, output
+ end
end
end
@@ -285,7 +285,12 @@ def create_table(*args, &block)
t.decimal :my_house_population, :precision => 2, :scale => 0
t.decimal :decimal_number_with_default, :precision => 3, :scale => 2, :default => 2.78
t.float :temperature
- t.decimal :atoms_in_universe, :precision => 55, :scale => 0
+ # Oracle supports precision up to 38
+ if current_adapter?(:OracleAdapter)
+ t.decimal :atoms_in_universe, :precision => 38, :scale => 0
+ else
+ t.decimal :atoms_in_universe, :precision => 55, :scale => 0
+ end
end
create_table :orders, :force => true do |t|

0 comments on commit 9b2309c

Please sign in to comment.