aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test/core_ext/date_time_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_time_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_time_ext_test.rb')
-rw-r--r--activesupport/test/core_ext/date_time_ext_test.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/activesupport/test/core_ext/date_time_ext_test.rb b/activesupport/test/core_ext/date_time_ext_test.rb
index 3da0825489..183d58482d 100644
--- a/activesupport/test/core_ext/date_time_ext_test.rb
+++ b/activesupport/test/core_ext/date_time_ext_test.rb
@@ -271,6 +271,18 @@ class DateTimeExtCalculationsTest < ActiveSupport::TestCase
assert_equal DateTime.civil(2004, 2, 29), DateTime.civil(2004, 3, 31).last_month
end
+ def test_next_quarter_on_31st
+ assert_equal DateTime.civil(2005, 11, 30), DateTime.civil(2005, 8, 31).next_quarter
+ end
+
+ def test_prev_quarter_on_31st
+ assert_equal DateTime.civil(2004, 2, 29), DateTime.civil(2004, 5, 31).prev_quarter
+ end
+
+ def test_last_quarter_on_31st
+ assert_equal DateTime.civil(2004, 2, 29), DateTime.civil(2004, 5, 31).last_quarter
+ end
+
def test_xmlschema
assert_match(/^1880-02-28T15:15:10\+00:?00$/, DateTime.civil(1880, 2, 28, 15, 15, 10).xmlschema)
assert_match(/^1980-02-28T15:15:10\+00:?00$/, DateTime.civil(1980, 2, 28, 15, 15, 10).xmlschema)