diff options
author | John Gesimondo <john@jmondo.com> | 2015-06-11 13:31:01 -0700 |
---|---|---|
committer | John Gesimondo <john@jmondo.com> | 2015-06-23 14:38:00 -0700 |
commit | 4f58c501cf9355258fe16b2526ac01586ff71b08 (patch) | |
tree | 79370cdaa16652def1a003c18896422605fa84d8 /activerecord/test/cases/adapters/postgresql | |
parent | 1022796ac075a5f1a3ca45f4d48284d4bfa2567a (diff) | |
download | rails-4f58c501cf9355258fe16b2526ac01586ff71b08.tar.gz rails-4f58c501cf9355258fe16b2526ac01586ff71b08.tar.bz2 rails-4f58c501cf9355258fe16b2526ac01586ff71b08.zip |
Display decimal defaults as strings to keep precision
Diffstat (limited to 'activerecord/test/cases/adapters/postgresql')
-rw-r--r-- | activerecord/test/cases/adapters/postgresql/money_test.rb | 2 | ||||
-rw-r--r-- | activerecord/test/cases/adapters/postgresql/schema_test.rb | 5 |
2 files changed, 6 insertions, 1 deletions
diff --git a/activerecord/test/cases/adapters/postgresql/money_test.rb b/activerecord/test/cases/adapters/postgresql/money_test.rb index e3670c203d..c031178479 100644 --- a/activerecord/test/cases/adapters/postgresql/money_test.rb +++ b/activerecord/test/cases/adapters/postgresql/money_test.rb @@ -56,7 +56,7 @@ class PostgresqlMoneyTest < ActiveRecord::PostgreSQLTestCase def test_schema_dumping output = dump_table_schema("postgresql_moneys") assert_match %r{t\.money\s+"wealth",\s+scale: 2$}, output - assert_match %r{t\.money\s+"depth",\s+scale: 2,\s+default: 150\.55$}, output + assert_match %r{t\.money\s+"depth",\s+scale: 2,\s+default: "150\.55"$}, output end def test_create_and_update_money diff --git a/activerecord/test/cases/adapters/postgresql/schema_test.rb b/activerecord/test/cases/adapters/postgresql/schema_test.rb index 9aba2b5976..35d5581aa7 100644 --- a/activerecord/test/cases/adapters/postgresql/schema_test.rb +++ b/activerecord/test/cases/adapters/postgresql/schema_test.rb @@ -480,6 +480,7 @@ class DefaultsUsingMultipleSchemasAndDomainTest < ActiveRecord::PostgreSQLTestCa @connection.create_table "defaults" do |t| t.text "text_col", default: "some value" t.string "string_col", default: "some value" + t.decimal "decimal_col", default: "3.14159265358979323846" end Default.reset_column_information end @@ -498,6 +499,10 @@ class DefaultsUsingMultipleSchemasAndDomainTest < ActiveRecord::PostgreSQLTestCa assert_equal "some value", Default.new.string_col, "Default of string column was not correctly parsed" end + def test_decimal_defaults_in_new_schema_when_overriding_domain + assert_equal BigDecimal.new("3.14159265358979323846"), Default.new.decimal_col, "Default of decimal column was not correctly parsed" + end + def test_bpchar_defaults_in_new_schema_when_overriding_domain @connection.execute "ALTER TABLE defaults ADD bpchar_col bpchar DEFAULT 'some value'" Default.reset_column_information |