diff options
author | Sean Griffin <sean@thoughtbot.com> | 2015-02-17 13:39:42 -0700 |
---|---|---|
committer | Sean Griffin <sean@thoughtbot.com> | 2015-02-17 13:39:42 -0700 |
commit | 9ca6948f72bef56445030a60e346376a821dbc72 (patch) | |
tree | 669b2e9b835a09067079c2afb3ff86df00e912e1 /activerecord/test/cases/type/decimal_test.rb | |
parent | 1455c4c22feb24b0ff2cbb191afb0bd98ebf7b06 (diff) | |
download | rails-9ca6948f72bef56445030a60e346376a821dbc72.tar.gz rails-9ca6948f72bef56445030a60e346376a821dbc72.tar.bz2 rails-9ca6948f72bef56445030a60e346376a821dbc72.zip |
`type_cast_from_user` -> `cast`
Diffstat (limited to 'activerecord/test/cases/type/decimal_test.rb')
-rw-r--r-- | activerecord/test/cases/type/decimal_test.rb | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/activerecord/test/cases/type/decimal_test.rb b/activerecord/test/cases/type/decimal_test.rb index 34ed1d7b19..fe49d0e79a 100644 --- a/activerecord/test/cases/type/decimal_test.rb +++ b/activerecord/test/cases/type/decimal_test.rb @@ -5,29 +5,29 @@ module ActiveRecord class DecimalTest < ActiveRecord::TestCase def test_type_cast_decimal type = Decimal.new - assert_equal BigDecimal.new("0"), type.type_cast_from_user(BigDecimal.new("0")) - assert_equal BigDecimal.new("123"), type.type_cast_from_user(123.0) - assert_equal BigDecimal.new("1"), type.type_cast_from_user(:"1") + assert_equal BigDecimal.new("0"), type.cast(BigDecimal.new("0")) + assert_equal BigDecimal.new("123"), type.cast(123.0) + assert_equal BigDecimal.new("1"), type.cast(:"1") end def test_type_cast_decimal_from_float_with_large_precision type = Decimal.new(precision: ::Float::DIG + 2) - assert_equal BigDecimal.new("123.0"), type.type_cast_from_user(123.0) + assert_equal BigDecimal.new("123.0"), type.cast(123.0) end def test_type_cast_from_float_with_unspecified_precision type = Decimal.new - assert_equal 22.68.to_d, type.type_cast_from_user(22.68) + assert_equal 22.68.to_d, type.cast(22.68) end def test_type_cast_decimal_from_rational_with_precision type = Decimal.new(precision: 2) - assert_equal BigDecimal("0.33"), type.type_cast_from_user(Rational(1, 3)) + assert_equal BigDecimal("0.33"), type.cast(Rational(1, 3)) end def test_type_cast_decimal_from_rational_without_precision_defaults_to_18_36 type = Decimal.new - assert_equal BigDecimal("0.333333333333333333E0"), type.type_cast_from_user(Rational(1, 3)) + assert_equal BigDecimal("0.333333333333333333E0"), type.cast(Rational(1, 3)) end def test_type_cast_decimal_from_object_responding_to_d @@ -36,7 +36,7 @@ module ActiveRecord BigDecimal.new("1") end type = Decimal.new - assert_equal BigDecimal("1"), type.type_cast_from_user(value) + assert_equal BigDecimal("1"), type.cast(value) end def test_changed? |