From da91450e687fe9faa7b0575062c2b2aacc261f68 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Mon, 2 Jun 2008 22:05:27 -0500 Subject: Added tests [#279 state:resolved] (Nicholas Schlueter) --- activesupport/test/core_ext/array_ext_test.rb | 5 +++++ activesupport/test/core_ext/bigdecimal.rb | 1 + activesupport/test/core_ext/date_ext_test.rb | 4 ++++ 3 files changed, 10 insertions(+) diff --git a/activesupport/test/core_ext/array_ext_test.rb b/activesupport/test/core_ext/array_ext_test.rb index ccab0f70d0..20bc5dfcb7 100644 --- a/activesupport/test/core_ext/array_ext_test.rb +++ b/activesupport/test/core_ext/array_ext_test.rb @@ -222,6 +222,11 @@ class ArrayToXmlTests < Test::Unit::TestCase assert xml.include?(%(2)), xml end + + def test_to_xml_with_empty + xml = [].to_xml + assert_match /type="array"\/>/, xml + end end class ArrayExtractOptionsTests < Test::Unit::TestCase diff --git a/activesupport/test/core_ext/bigdecimal.rb b/activesupport/test/core_ext/bigdecimal.rb index 0417a2bca0..9faad9146f 100644 --- a/activesupport/test/core_ext/bigdecimal.rb +++ b/activesupport/test/core_ext/bigdecimal.rb @@ -5,5 +5,6 @@ class BigDecimalTest < Test::Unit::TestCase 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/date_ext_test.rb b/activesupport/test/core_ext/date_ext_test.rb index e1d2f0e7f2..11b6056047 100644 --- a/activesupport/test/core_ext/date_ext_test.rb +++ b/activesupport/test/core_ext/date_ext_test.rb @@ -198,6 +198,10 @@ class DateExtCalculationsTest < Test::Unit::TestCase assert_equal Time.local(2005,2,21,23,59,59), Date.new(2005,2,21).end_of_day end + def test_date_acts_like_date + assert Date.new.acts_like_date? + end + def test_xmlschema with_env_tz 'US/Eastern' do assert_match(/^1980-02-28T00:00:00-05:?00$/, Date.new(1980, 2, 28).xmlschema) -- cgit v1.2.3