public
Fork of NZKoz/koz-rails
Description: Koz's rails git-svn clone
Homepage: http://www.rubyonrails.org
Clone URL: git://github.com/eventualbuddha/koz-rails.git
Search Repo:
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

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9009 
5ecf4fe2-1ee6-0310-87b1-e25e094e27de
gbuesing (author)
Tue Mar 11 00:19:36 -0700 2008
commit  3d2cd05b61da6339629ee641413cacdd1ffd22fa
tree    e105e2f0dab30ef35d25fee2ebe287670e4d5241
parent  070dfb45338573d7b7239cfe08830cdd719dcb63
...
1
2
 
 
3
4
5
...
1
2
3
4
5
6
7
0
@@ -1,5 +1,7 @@
0
 *SVN*
0
 
0
+* 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]
0
+
0
 * Removing unneeded #change_time_zone method from Time, DateTime and TimeWithZone [Geoff Buesing]
0
 
0
 * TimeZone #local and #now correctly enforce DST rules [Geoff Buesing]
...
2
3
4
5
6
 
 
7
8
9
...
2
3
4
 
 
5
6
7
8
9
0
@@ -2,8 +2,8 @@
0
 
0
 class NumericExtTimeAndDateTimeTest < Test::Unit::TestCase
0
   def setup
0
- @now = Time.now
0
- @dtnow = DateTime.now
0
+ @now = Time.local(2005,2,10,15,30,45)
0
+ @dtnow = DateTime.civil(2005,2,10,15,30,45)
0
     @seconds = {
0
       1.minute => 60,
0
       10.minutes => 600,
...
83
84
85
86
 
87
88
 
89
90
91
...
83
84
85
 
86
87
 
88
89
90
91
0
@@ -83,9 +83,9 @@
0
       
0
       def test_now_enforces_fall_dst_rules
0
         with_env_tz 'US/Eastern' do
0
- Time.stubs(:now).returns(Time.local(2006,10,29,1)) # 1AM is ambiguous; could be DST or non-DST 1AM
0
+ Time.stubs(:now).returns(Time.at(1162098000)) # equivalent to 1AM DST
0
           zone = TimeZone['Eastern Time (US & Canada)']
0
- assert_equal Time.utc(2006,10,29,1), zone.now.time # selects DST 1AM
0
+ assert_equal Time.utc(2006,10,29,1), zone.now.time
0
           assert_equal true, zone.now.dst?
0
         end
0
       end

Comments

    No one has commented yet.