aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/adapters/postgresql/money_test.rb
diff options
context:
space:
mode:
authorSean Griffin <sean@thoughtbot.com>2015-01-30 11:42:54 -0700
committerSean Griffin <sean@thoughtbot.com>2015-01-30 11:42:54 -0700
commitb93b39eff6829ee05ffec1cc8c505f69cbb53fdc (patch)
tree5b37fc7c7d36cc6e0abc2530606ea3acad05362c /activerecord/test/cases/adapters/postgresql/money_test.rb
parent155b1b7fe3a1d231fb98a6fb04a21f6eb190b98f (diff)
downloadrails-b93b39eff6829ee05ffec1cc8c505f69cbb53fdc.tar.gz
rails-b93b39eff6829ee05ffec1cc8c505f69cbb53fdc.tar.bz2
rails-b93b39eff6829ee05ffec1cc8c505f69cbb53fdc.zip
Remove most type related predicates from `Column`
Remaining are `limit`, `precision`, `scale`, and `type` (the symbol version). These will remain on the column, since they mirror the options to the `column` method in the schema definition DSL
Diffstat (limited to 'activerecord/test/cases/adapters/postgresql/money_test.rb')
-rw-r--r--activerecord/test/cases/adapters/postgresql/money_test.rb16
1 files changed, 9 insertions, 7 deletions
diff --git a/activerecord/test/cases/adapters/postgresql/money_test.rb b/activerecord/test/cases/adapters/postgresql/money_test.rb
index 78afd49b0b..ed1b7d0a1c 100644
--- a/activerecord/test/cases/adapters/postgresql/money_test.rb
+++ b/activerecord/test/cases/adapters/postgresql/money_test.rb
@@ -25,9 +25,11 @@ class PostgresqlMoneyTest < ActiveRecord::TestCase
assert_equal :money, column.type
assert_equal "money", column.sql_type
assert_equal 2, column.scale
- assert column.number?
- assert_not column.binary?
assert_not column.array?
+
+ type = PostgresqlMoney.type_for_attribute("wealth")
+ assert type.number?
+ assert_not type.binary?
end
def test_default
@@ -46,11 +48,11 @@ class PostgresqlMoneyTest < ActiveRecord::TestCase
end
def test_money_type_cast
- column = PostgresqlMoney.columns_hash['wealth']
- assert_equal(12345678.12, column.type_cast_from_user("$12,345,678.12"))
- assert_equal(12345678.12, column.type_cast_from_user("$12.345.678,12"))
- assert_equal(-1.15, column.type_cast_from_user("-$1.15"))
- assert_equal(-2.25, column.type_cast_from_user("($2.25)"))
+ 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)"))
end
def test_schema_dumping