Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Adjust test in case tzinfo is not available

  • Loading branch information...
commit 19161e08b33947d617d3562986983bd9b43abb28 1 parent e2ec41a
@jeremy jeremy authored
Showing with 8 additions and 4 deletions.
  1. +8 −4 activesupport/test/time_zone_test.rb
View
12 activesupport/test/time_zone_test.rb
@@ -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
Please sign in to comment.
Something went wrong with that request. Please try again.