Check more carefully for vendored tzinfo

This commit is contained in:
Jeremy Kemper
2010-04-02 14:39:03 -07:00
parent 19161e08b3
commit a72bcdb8ae

View File

@@ -75,13 +75,16 @@ class TimeZoneTest < Test::Unit::TestCase
def test_unknown_timezones_delegation_to_tzinfo
zone = ActiveSupport::TimeZone['America/Montevideo']
if defined?(TZInfo::TimeZone)
begin
require 'tzinfo/country'
rescue LoadError
# using vendored tzinfo which doesn't have tzinfo/country
assert_nil zone
else
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