diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2011-01-10 15:43:21 -0800 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2011-01-10 15:51:37 -0800 |
commit | 1cc556dc5263bbbe5845b9a7abde9c84dffa7fb0 (patch) | |
tree | fb72fab8e7d7f2f4fc5d5b4f854447fe8b1b2dd0 /activesupport/test/core_ext/bigdecimal_test.rb | |
parent | f4f4964ce0a05cac38bbff3b308ac558228bad29 (diff) | |
download | rails-1cc556dc5263bbbe5845b9a7abde9c84dffa7fb0.tar.gz rails-1cc556dc5263bbbe5845b9a7abde9c84dffa7fb0.tar.bz2 rails-1cc556dc5263bbbe5845b9a7abde9c84dffa7fb0.zip |
adding to_d to BigDecimal
Diffstat (limited to 'activesupport/test/core_ext/bigdecimal_test.rb')
-rw-r--r-- | activesupport/test/core_ext/bigdecimal_test.rb | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/activesupport/test/core_ext/bigdecimal_test.rb b/activesupport/test/core_ext/bigdecimal_test.rb new file mode 100644 index 0000000000..0272f564de --- /dev/null +++ b/activesupport/test/core_ext/bigdecimal_test.rb @@ -0,0 +1,15 @@ +require 'abstract_unit' + +class BigDecimalTest < Test::Unit::TestCase + def test_to_yaml + assert_equal("--- 100000.30020320320000000000000000000000000000001\n", BigDecimal.new('100000.30020320320000000000000000000000000000001').to_yaml) + assert_equal("--- .Inf\n", BigDecimal.new('Infinity').to_yaml) + assert_equal("--- .NaN\n", BigDecimal.new('NaN').to_yaml) + assert_equal("--- -.Inf\n", BigDecimal.new('-Infinity').to_yaml) + end + + def test_to_d + bd = BigDecimal.new '10' + assert_equal bd, bd.to_d + end +end |