Skip to content
Browse files

Fix Numeric time tests broken by DST change by anchoring them to fixe…

…d times instead of Time.now. Anchor TimeZone#now DST test to time specified with Time.at instead of Time.local to work around platform differences with Time.local and DST representation

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9009 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
1 parent 3af5b27 commit 5483de0cc345772eb22a461c4509a0bd072863a9 @gbuesing gbuesing committed Mar 11, 2008
View
2 activesupport/CHANGELOG
@@ -1,5 +1,7 @@
*SVN*
+* Fix Numeric time tests broken by DST change by anchoring them to fixed times instead of Time.now. Anchor TimeZone#now DST test to time specified with Time.at instead of Time.local to work around platform differences with Time.local and DST representation [Geoff Buesing]
+
* Removing unneeded #change_time_zone method from Time, DateTime and TimeWithZone [Geoff Buesing]
* TimeZone #local and #now correctly enforce DST rules [Geoff Buesing]
View
4 activesupport/test/core_ext/numeric_ext_test.rb
@@ -2,8 +2,8 @@
class NumericExtTimeAndDateTimeTest < Test::Unit::TestCase
def setup
- @now = Time.now
- @dtnow = DateTime.now
+ @now = Time.local(2005,2,10,15,30,45)
+ @dtnow = DateTime.civil(2005,2,10,15,30,45)
@seconds = {
1.minute => 60,
10.minutes => 600,
View
4 activesupport/test/time_zone_test.rb
@@ -83,9 +83,9 @@ def test_now_enforces_spring_dst_rules
def test_now_enforces_fall_dst_rules
with_env_tz 'US/Eastern' do
- Time.stubs(:now).returns(Time.local(2006,10,29,1)) # 1AM is ambiguous; could be DST or non-DST 1AM
+ Time.stubs(:now).returns(Time.at(1162098000)) # equivalent to 1AM DST
zone = TimeZone['Eastern Time (US & Canada)']
- assert_equal Time.utc(2006,10,29,1), zone.now.time # selects DST 1AM
+ assert_equal Time.utc(2006,10,29,1), zone.now.time
assert_equal true, zone.now.dst?
end
end

0 comments on commit 5483de0

Please sign in to comment.
Something went wrong with that request. Please try again.