aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport
diff options
context:
space:
mode:
authorXavier Noria <fxn@hashref.com>2010-05-08 18:46:15 +0200
committerXavier Noria <fxn@hashref.com>2010-05-08 18:46:15 +0200
commit7184a9e6432d0e5e733bd0c25a5c9714623692c4 (patch)
tree78bcb99709993e2a65c1881b275aae8e69a60422 /activesupport
parent788684d75a7102107c0d99e5cb32a11a610f628f (diff)
downloadrails-7184a9e6432d0e5e733bd0c25a5c9714623692c4.tar.gz
rails-7184a9e6432d0e5e733bd0c25a5c9714623692c4.tar.bz2
rails-7184a9e6432d0e5e733bd0c25a5c9714623692c4.zip
add test coverage for (last|next)_year on leap years
Diffstat (limited to 'activesupport')
-rw-r--r--activesupport/test/core_ext/date_ext_test.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/activesupport/test/core_ext/date_ext_test.rb b/activesupport/test/core_ext/date_ext_test.rb
index 1f94b80edc..d5f3eed8c1 100644
--- a/activesupport/test/core_ext/date_ext_test.rb
+++ b/activesupport/test/core_ext/date_ext_test.rb
@@ -141,10 +141,18 @@ class DateExtCalculationsTest < Test::Unit::TestCase
assert_equal Date.new(2004,6,5), Date.new(2005,6,5).last_year
end
+ def test_last_year_in_leap_years
+ assert_equal Date.new(1999,2,28), Date.new(2000,2,29).last_year
+ end
+
def test_next_year
assert_equal Date.new(2006,6,5), Date.new(2005,6,5).next_year
end
+ def test_next_year_in_leap_years
+ assert_equal Date.new(2001,2,28), Date.new(2000,2,29).next_year
+ end
+
def test_yesterday
assert_equal Date.new(2005,2,21), Date.new(2005,2,22).yesterday
assert_equal Date.new(2005,2,28), Date.new(2005,3,2).yesterday.yesterday