From 1cc556dc5263bbbe5845b9a7abde9c84dffa7fb0 Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Mon, 10 Jan 2011 15:43:21 -0800 Subject: adding to_d to BigDecimal --- activesupport/test/core_ext/bigdecimal.rb | 10 ---------- activesupport/test/core_ext/bigdecimal_test.rb | 15 +++++++++++++++ 2 files changed, 15 insertions(+), 10 deletions(-) delete mode 100644 activesupport/test/core_ext/bigdecimal.rb create mode 100644 activesupport/test/core_ext/bigdecimal_test.rb (limited to 'activesupport/test/core_ext') diff --git a/activesupport/test/core_ext/bigdecimal.rb b/activesupport/test/core_ext/bigdecimal.rb deleted file mode 100644 index 9faad9146f..0000000000 --- a/activesupport/test/core_ext/bigdecimal.rb +++ /dev/null @@ -1,10 +0,0 @@ -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 -end \ No newline at end of file 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 -- cgit v1.2.3