Permalink
Browse files

add test coverage for (last|next)_year on leap years

  • Loading branch information...
1 parent 788684d commit 7184a9e6432d0e5e733bd0c25a5c9714623692c4 @fxn fxn committed May 8, 2010
Showing with 8 additions and 0 deletions.
  1. +8 −0 activesupport/test/core_ext/date_ext_test.rb
@@ -141,10 +141,18 @@ def test_last_year
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

0 comments on commit 7184a9e

Please sign in to comment.