Remove deprecated core_ext/big_decimal/yaml_conversions file

上级 a3ce6ca3
* Remove deprecated `active_support/core_ext/big_decimal/yaml_conversions`
file.
*Rafael Mendonça França*
* Remove deprecated methods `ActiveSupport::Cache::Store.instrument` and
`ActiveSupport::Cache::Store.instrument=`.
......
ActiveSupport::Deprecation.warn 'core_ext/big_decimal/yaml_conversions is deprecated and will be removed in the future.'
require 'bigdecimal'
require 'yaml'
require 'active_support/core_ext/big_decimal/conversions'
class BigDecimal
YAML_MAPPING = { 'Infinity' => '.Inf', '-Infinity' => '-.Inf', 'NaN' => '.NaN' }
def encode_with(coder)
string = to_s
coder.represent_scalar(nil, YAML_MAPPING[string] || string)
end
end
require 'abstract_unit'
class BigDecimalYamlConversionsTest < ActiveSupport::TestCase
def test_to_yaml
assert_deprecated { require 'active_support/core_ext/big_decimal/yaml_conversions' }
assert_match("--- 100000.30020320320000000000000000000000000000001\n", BigDecimal.new('100000.30020320320000000000000000000000000000001').to_yaml)
assert_match("--- .Inf\n", BigDecimal.new('Infinity').to_yaml)
assert_match("--- .NaN\n", BigDecimal.new('NaN').to_yaml)
assert_match("--- -.Inf\n", BigDecimal.new('-Infinity').to_yaml)
end
end
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册