aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test/core_ext/date_ext_test.rb
diff options
context:
space:
mode:
authorparanoiase Kang <paranoiase@gmail.com>2012-05-20 14:33:58 +0900
committerCarlos Antonio da Silva <carlosantoniodasilva@gmail.com>2012-06-20 11:39:11 -0300
commit2773257ac64c82affae527436b08e6d627853c1d (patch)
treebbe0186dc87c3039abd13d59c39f8eee8bba14b1 /activesupport/test/core_ext/date_ext_test.rb
parent1bb2f5a8316c3e94b47b9cfb8fa519e1b1238869 (diff)
downloadrails-2773257ac64c82affae527436b08e6d627853c1d.tar.gz
rails-2773257ac64c82affae527436b08e6d627853c1d.tar.bz2
rails-2773257ac64c82affae527436b08e6d627853c1d.zip
Add prev_quarter and next_quarter method in Time/Date/DateTime
Diffstat (limited to 'activesupport/test/core_ext/date_ext_test.rb')
-rw-r--r--activesupport/test/core_ext/date_ext_test.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/activesupport/test/core_ext/date_ext_test.rb b/activesupport/test/core_ext/date_ext_test.rb
index e14a137f84..088b74a29a 100644
--- a/activesupport/test/core_ext/date_ext_test.rb
+++ b/activesupport/test/core_ext/date_ext_test.rb
@@ -289,6 +289,18 @@ class DateExtCalculationsTest < ActiveSupport::TestCase
assert_equal Date.new(2004, 2, 29), Date.new(2004, 3, 31).last_month
end
+ def test_next_quarter_on_31st
+ assert_equal Date.new(2005, 11, 30), Date.new(2005, 8, 31).next_quarter
+ end
+
+ def test_prev_quarter_on_31st
+ assert_equal Date.new(2004, 2, 29), Date.new(2004, 5, 31).prev_quarter
+ end
+
+ def test_last_quarter_on_31st
+ assert_equal Date.new(2004, 2, 29), Date.new(2004, 5, 31).last_quarter
+ end
+
def test_yesterday_constructor
assert_equal Date.current - 1, Date.yesterday
end