aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test/core_ext/duration_test.rb
diff options
context:
space:
mode:
authorMichael Curtis <m.curtis@me.com>2009-03-10 12:14:54 -0500
committerGeoff Buesing <gbuesing@gmail.com>2009-03-29 16:15:44 -0500
commit5a8b481f717470b952ac7eb890f260ea98428153 (patch)
tree5d7f20143fb24dc78b64e970cb2d3bb14e754e06 /activesupport/test/core_ext/duration_test.rb
parentdd2eb1ea7c34eb6496feaf7e42100f37a8dae76b (diff)
downloadrails-5a8b481f717470b952ac7eb890f260ea98428153.tar.gz
rails-5a8b481f717470b952ac7eb890f260ea98428153.tar.bz2
rails-5a8b481f717470b952ac7eb890f260ea98428153.zip
Time.local instances: Adding 24.hours across the DST boundary adds 24 hours instead of one day [#2066 state:resolved]
Diffstat (limited to 'activesupport/test/core_ext/duration_test.rb')
-rw-r--r--activesupport/test/core_ext/duration_test.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/activesupport/test/core_ext/duration_test.rb b/activesupport/test/core_ext/duration_test.rb
index ab5a86668e..8954295d10 100644
--- a/activesupport/test/core_ext/duration_test.rb
+++ b/activesupport/test/core_ext/duration_test.rb
@@ -109,6 +109,18 @@ class DurationTest < ActiveSupport::TestCase
ensure
Time.zone_default = nil
end
+
+ def test_adding_hours_across_dst_boundary
+ with_env_tz 'CET' do
+ assert_equal Time.local(2009,3,29,0,0,0) + 24.hours, Time.local(2009,3,30,1,0,0)
+ end
+ end
+
+ def test_adding_day_across_dst_boundary
+ with_env_tz 'CET' do
+ assert_equal Time.local(2009,3,29,0,0,0) + 1.day, Time.local(2009,3,30,0,0,0)
+ end
+ end
protected
def with_env_tz(new_tz = 'US/Eastern')