mirror of
https://github.com/github/rails.git
synced 2026-01-14 17:18:04 -05:00
Check more carefully for vendored tzinfo
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user