Skip to content

Commit

Permalink
Add failing test for postgresql numeric without scale and precision
Browse files Browse the repository at this point in the history
  • Loading branch information
til committed May 16, 2011
1 parent 1490783 commit c72b59d
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
1 change: 1 addition & 0 deletions test/models/data_types.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ def self.up
t.column :sample_time, :time
t.column :sample_decimal, :decimal, :precision => 15, :scale => 0
t.column :sample_small_decimal, :decimal, :precision => 3, :scale => 2
t.column :sample_default_decimal, :decimal
t.column :sample_float, :float
t.column :sample_binary, :binary
t.column :sample_boolean, :boolean
Expand Down
25 changes: 25 additions & 0 deletions test/postgres_numeric_test.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# To run this script, set up the following postgres user and database:
#
# sudo -u postgres createuser -D -A -P blog
# sudo -u postgres createdb -O blog weblog_development
#

require 'jdbc_common'
require 'db/postgres'

class PostgresNumericTest < Test::Unit::TestCase
def setup
DbTypeMigration.up
end

def teardown
DbTypeMigration.down
end

def test_should_keep_fractional_part
expected = 7.3
actual = DbType.create(:sample_default_decimal => expected).sample_default_decimal

assert_equal expected, actual
end
end

0 comments on commit c72b59d

Please sign in to comment.