Skip to content

Commit

Permalink
Don't hardcode UTC offsets in test
Browse files Browse the repository at this point in the history
The test only worked if you happened to be running it on the West Coast.
Use correct local offsets.
  • Loading branch information
gcampbell committed Jul 27, 2010
1 parent 8f7edca commit 59d4b97
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions spec/integration/timezone_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ def test_timezone
end

Sequel.datetime_class = DateTime
[DateTime.now, DateTime.civil(2010,1,1,12,0,0,Rational(-8,24)), DateTime.civil(2010,6,1,12,0,0,Rational(-7,24))].each do |dt|
local_dst_offset = Rational(Time.local(2010, 6).utc_offset, 60*60*24)
local_std_offset = Rational(Time.local(2010, 1).utc_offset, 60*60*24)
[DateTime.now, DateTime.civil(2010,1,1,12,0,0,local_std_offset), DateTime.civil(2010,6,1,12,0,0,local_dst_offset)].each do |dt|
@db[:t].insert(dt)
dt2 = @db[:t].single_value
dt2 = Sequel.database_to_application_timestamp(dt2.to_s) unless dt2.is_a?(DateTime)
Expand Down Expand Up @@ -56,4 +58,4 @@ def test_timezone
Sequel.default_timezone = :local
test_timezone
end
end
end

0 comments on commit 59d4b97

Please sign in to comment.