diff options
author | George Claghorn <george.claghorn@gmail.com> | 2015-01-06 05:30:04 -0500 |
---|---|---|
committer | George Claghorn <george.claghorn@gmail.com> | 2015-01-06 05:43:41 -0500 |
commit | 4c53f58a0fc89dd8bf0ea9abd40b7a198dd13b99 (patch) | |
tree | 9878b6428d0c6f7087050d3025d83785cd54282f /activesupport/test/core_ext | |
parent | b6d0d0d106b5cd59f8da3f893b29a05bc85ac14e (diff) | |
download | rails-4c53f58a0fc89dd8bf0ea9abd40b7a198dd13b99.tar.gz rails-4c53f58a0fc89dd8bf0ea9abd40b7a198dd13b99.tar.bz2 rails-4c53f58a0fc89dd8bf0ea9abd40b7a198dd13b99.zip |
Add #prev_day and #next_day as counterparts to #yesterday and #tomorrow for Date, Time, and DateTime
Diffstat (limited to 'activesupport/test/core_ext')
-rw-r--r-- | activesupport/test/core_ext/date_and_time_behavior.rb | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/activesupport/test/core_ext/date_and_time_behavior.rb b/activesupport/test/core_ext/date_and_time_behavior.rb index 6b6e1a2a4c..784547bdf8 100644 --- a/activesupport/test/core_ext/date_and_time_behavior.rb +++ b/activesupport/test/core_ext/date_and_time_behavior.rb @@ -6,11 +6,21 @@ module DateAndTimeBehavior assert_equal date_time_init(2005,2,28,10,10,10), date_time_init(2005,3,2,10,10,10).yesterday.yesterday end + def test_prev_day + assert_equal date_time_init(2005,2,21,10,10,10), date_time_init(2005,2,22,10,10,10).prev_day + assert_equal date_time_init(2005,2,28,10,10,10), date_time_init(2005,3,2,10,10,10).prev_day.prev_day + end + def test_tomorrow assert_equal date_time_init(2005,2,23,10,10,10), date_time_init(2005,2,22,10,10,10).tomorrow assert_equal date_time_init(2005,3,2,10,10,10), date_time_init(2005,2,28,10,10,10).tomorrow.tomorrow end + def test_next_day + assert_equal date_time_init(2005,2,23,10,10,10), date_time_init(2005,2,22,10,10,10).next_day + assert_equal date_time_init(2005,3,2,10,10,10), date_time_init(2005,2,28,10,10,10).next_day.next_day + end + def test_days_ago assert_equal date_time_init(2005,6,4,10,10,10), date_time_init(2005,6,5,10,10,10).days_ago(1) assert_equal date_time_init(2005,5,31,10,10,10), date_time_init(2005,6,5,10,10,10).days_ago(5) |