Skip to content

Commit

Permalink
Adjust test in case tzinfo is not available
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremy committed Apr 2, 2010
1 parent e2ec41a commit 19161e0
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions activesupport/test/time_zone_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,14 @@ def test_now_enforces_fall_dst_rules

def test_unknown_timezones_delegation_to_tzinfo
zone = ActiveSupport::TimeZone['America/Montevideo']
assert_equal ActiveSupport::TimeZone, zone.class
assert_equal zone.object_id, ActiveSupport::TimeZone['America/Montevideo'].object_id
assert_equal Time.utc(2010, 1, 31, 22), zone.utc_to_local(Time.utc(2010, 2)) # daylight saving offset -0200
assert_equal Time.utc(2010, 3, 31, 21), zone.utc_to_local(Time.utc(2010, 4)) # standard offset -0300
if defined?(TZInfo::TimeZone)
assert_equal ActiveSupport::TimeZone, zone.class
assert_equal zone.object_id, ActiveSupport::TimeZone['America/Montevideo'].object_id
assert_equal Time.utc(2010, 1, 31, 22), zone.utc_to_local(Time.utc(2010, 2)) # daylight saving offset -0200
assert_equal Time.utc(2010, 3, 31, 21), zone.utc_to_local(Time.utc(2010, 4)) # standard offset -0300
else
assert_nil zone
end
end

def test_today
Expand Down

0 comments on commit 19161e0

Please sign in to comment.