diff options
author | Xavier Noria <fxn@hashref.com> | 2010-05-05 00:30:15 +0200 |
---|---|---|
committer | Xavier Noria <fxn@hashref.com> | 2010-05-05 00:35:06 +0200 |
commit | 53c1cd6cde6e34996ff85960f06749b681200908 (patch) | |
tree | 9d69ca78887aa9222a09b945cae581eb70b0d11c /activesupport/test/core_ext/date_ext_test.rb | |
parent | 38da0ace772e6f9f5e2fff74db76237ab31790fa (diff) | |
download | rails-53c1cd6cde6e34996ff85960f06749b681200908.tar.gz rails-53c1cd6cde6e34996ff85960f06749b681200908.tar.bz2 rails-53c1cd6cde6e34996ff85960f06749b681200908.zip |
let Time.time_with_datetime_fallback handle properly years in the range 0..138
Diffstat (limited to 'activesupport/test/core_ext/date_ext_test.rb')
-rw-r--r-- | activesupport/test/core_ext/date_ext_test.rb | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/activesupport/test/core_ext/date_ext_test.rb b/activesupport/test/core_ext/date_ext_test.rb index c403d7fb11..1f94b80edc 100644 --- a/activesupport/test/core_ext/date_ext_test.rb +++ b/activesupport/test/core_ext/date_ext_test.rb @@ -20,6 +20,13 @@ class DateExtCalculationsTest < Test::Unit::TestCase def test_to_time assert_equal Time.local(2005, 2, 21), Date.new(2005, 2, 21).to_time assert_equal Time.local_time(2039, 2, 21), Date.new(2039, 2, 21).to_time + silence_warnings do + 0.upto(138) do |year| + [:utc, :local].each do |format| + assert_equal year, Date.new(year).to_time(format).year + end + end + end end def test_to_datetime @@ -89,7 +96,6 @@ class DateExtCalculationsTest < Test::Unit::TestCase assert_equal Date.new(2005,3,31), Date.new(2005,3,20).end_of_month assert_equal Date.new(2005,2,28), Date.new(2005,2,20).end_of_month assert_equal Date.new(2005,4,30), Date.new(2005,4,20).end_of_month - end def test_beginning_of_year |