diff options
Diffstat (limited to 'activerecord/test/cases/adapters/postgresql/money_test.rb')
-rw-r--r-- | activerecord/test/cases/adapters/postgresql/money_test.rb | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/activerecord/test/cases/adapters/postgresql/money_test.rb b/activerecord/test/cases/adapters/postgresql/money_test.rb index 4288f754c0..cedd399380 100644 --- a/activerecord/test/cases/adapters/postgresql/money_test.rb +++ b/activerecord/test/cases/adapters/postgresql/money_test.rb @@ -10,13 +10,13 @@ class PostgresqlMoneyTest < ActiveRecord::TestCase @connection = ActiveRecord::Base.connection @connection.execute("set lc_monetary = 'C'") @connection.create_table('postgresql_moneys', force: true) do |t| - t.column "wealth", "money" - t.column "depth", "money", default: "150.55" + t.money "wealth" + t.money "depth", default: "150.55" end end teardown do - @connection.execute 'DROP TABLE IF EXISTS postgresql_moneys' + @connection.drop_table 'postgresql_moneys', if_exists: true end def test_column @@ -27,7 +27,6 @@ class PostgresqlMoneyTest < ActiveRecord::TestCase assert_not column.array? type = PostgresqlMoney.type_for_attribute("wealth") - assert type.number? assert_not type.binary? end @@ -48,10 +47,10 @@ class PostgresqlMoneyTest < ActiveRecord::TestCase def test_money_type_cast type = PostgresqlMoney.type_for_attribute('wealth') - assert_equal(12345678.12, type.type_cast_from_user("$12,345,678.12")) - assert_equal(12345678.12, type.type_cast_from_user("$12.345.678,12")) - assert_equal(-1.15, type.type_cast_from_user("-$1.15")) - assert_equal(-2.25, type.type_cast_from_user("($2.25)")) + assert_equal(12345678.12, type.cast("$12,345,678.12")) + assert_equal(12345678.12, type.cast("$12.345.678,12")) + assert_equal(-1.15, type.cast("-$1.15")) + assert_equal(-2.25, type.cast("($2.25)")) end def test_schema_dumping |