diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2007-10-13 21:47:45 +0000 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2007-10-13 21:47:45 +0000 |
commit | 389616e68d2b4f1f48014cf9d6d45754936c7bed (patch) | |
tree | 133ccacfefa426c1ce460267122dbda96fd705f9 /activesupport/test/core_ext | |
parent | c7dd2a1c11c4cf66eac1b6c00ded956b1c3d55f6 (diff) | |
download | rails-389616e68d2b4f1f48014cf9d6d45754936c7bed.tar.gz rails-389616e68d2b4f1f48014cf9d6d45754936c7bed.tar.bz2 rails-389616e68d2b4f1f48014cf9d6d45754936c7bed.zip |
Fix Time#years_ago and #years_since from leap days. Closes #9865.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7867 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activesupport/test/core_ext')
-rw-r--r-- | activesupport/test/core_ext/time_ext_test.rb | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/activesupport/test/core_ext/time_ext_test.rb b/activesupport/test/core_ext/time_ext_test.rb index f1b4e23622..f3e9900510 100644 --- a/activesupport/test/core_ext/time_ext_test.rb +++ b/activesupport/test/core_ext/time_ext_test.rb @@ -119,11 +119,13 @@ class TimeExtCalculationsTest < Test::Unit::TestCase def test_years_ago assert_equal Time.local(2004,6,5,10), Time.local(2005,6,5,10,0,0).years_ago(1) assert_equal Time.local(1998,6,5,10), Time.local(2005,6,5,10,0,0).years_ago(7) + assert_equal Time.local(2003,2,28,10), Time.local(2004,2,29,10,0,0).years_ago(1) # 1 year ago from leap day end def test_years_since assert_equal Time.local(2006,6,5,10), Time.local(2005,6,5,10,0,0).years_since(1) assert_equal Time.local(2012,6,5,10), Time.local(2005,6,5,10,0,0).years_since(7) + assert_equal Time.local(2005,2,28,10), Time.local(2004,2,29,10,0,0).years_since(1) # 1 year since leap day # Failure because of size limitations of numeric? # assert_equal Time.local(2182,6,5,10), Time.local(2005,6,5,10,0,0).years_since(177) end |