aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test/core_ext/time_ext_test.rb
diff options
context:
space:
mode:
authorAndrew White <andyw@pixeltrix.co.uk>2014-01-05 11:19:00 -0800
committerAndrew White <andyw@pixeltrix.co.uk>2014-01-05 11:19:00 -0800
commitffc273577a795bb41068bfc2a1bb575ec51a9712 (patch)
treea67944ccfbec8fca504f7377b911f65e1849a9d7 /activesupport/test/core_ext/time_ext_test.rb
parent6e867a4dfed31f364d3917dcb8d555f655a73f9e (diff)
parent0c6ddbe7b0056cb5c17d6b483c0e5a7cbd596b97 (diff)
downloadrails-ffc273577a795bb41068bfc2a1bb575ec51a9712.tar.gz
rails-ffc273577a795bb41068bfc2a1bb575ec51a9712.tar.bz2
rails-ffc273577a795bb41068bfc2a1bb575ec51a9712.zip
Merge pull request #10634 from teleological/time_advance_gregorian
Maintain proleptic gregorian in Time#advance
Diffstat (limited to 'activesupport/test/core_ext/time_ext_test.rb')
-rw-r--r--activesupport/test/core_ext/time_ext_test.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/activesupport/test/core_ext/time_ext_test.rb b/activesupport/test/core_ext/time_ext_test.rb
index 41a1df084e..e0a4b1be3e 100644
--- a/activesupport/test/core_ext/time_ext_test.rb
+++ b/activesupport/test/core_ext/time_ext_test.rb
@@ -476,6 +476,13 @@ class TimeExtCalculationsTest < ActiveSupport::TestCase
assert_equal t, t.advance(:months => 0)
end
+ def test_advance_gregorian_proleptic
+ assert_equal Time.local(1582,10,14,15,15,10), Time.local(1582,10,15,15,15,10).advance(:days => -1)
+ assert_equal Time.local(1582,10,15,15,15,10), Time.local(1582,10,14,15,15,10).advance(:days => 1)
+ assert_equal Time.local(1582,10,5,15,15,10), Time.local(1582,10,4,15,15,10).advance(:days => 1)
+ assert_equal Time.local(1582,10,4,15,15,10), Time.local(1582,10,5,15,15,10).advance(:days => -1)
+ end
+
def test_last_week
with_env_tz 'US/Eastern' do
assert_equal Time.local(2005,2,21), Time.local(2005,3,1,15,15,10).last_week