From a72bcdb8aedd8cbfa0efc2ca95fe4c7553227f80 Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Fri, 2 Apr 2010 14:39:03 -0700 Subject: [PATCH] Check more carefully for vendored tzinfo --- activesupport/test/time_zone_test.rb | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/activesupport/test/time_zone_test.rb b/activesupport/test/time_zone_test.rb index b2bdea2934..2802ffd54a 100644 --- a/activesupport/test/time_zone_test.rb +++ b/activesupport/test/time_zone_test.rb @@ -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