aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test/time_zone_test.rb
diff options
context:
space:
mode:
authorSantiago Pastorino <santiago@wyeworks.com>2010-04-02 16:44:38 -0300
committerSantiago Pastorino <santiago@wyeworks.com>2010-04-02 17:43:48 -0300
commit1b742ea9b100278dd818879a4162dab1a2c0e6d4 (patch)
treeeea2fb35a6a69a373a46ed4222807c728cad63b9 /activesupport/test/time_zone_test.rb
parent90e3343ae5f9daa1458fc37e220d89cdb41b3185 (diff)
downloadrails-1b742ea9b100278dd818879a4162dab1a2c0e6d4.tar.gz
rails-1b742ea9b100278dd818879a4162dab1a2c0e6d4.tar.bz2
rails-1b742ea9b100278dd818879a4162dab1a2c0e6d4.zip
delegate unknown timezones to TZInfo
Diffstat (limited to 'activesupport/test/time_zone_test.rb')
-rw-r--r--activesupport/test/time_zone_test.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/activesupport/test/time_zone_test.rb b/activesupport/test/time_zone_test.rb
index ce43c6507d..68027f7c94 100644
--- a/activesupport/test/time_zone_test.rb
+++ b/activesupport/test/time_zone_test.rb
@@ -75,6 +75,14 @@ class TimeZoneTest < Test::Unit::TestCase
end
end
+ 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
+ end
+
def test_today
Time.stubs(:now).returns(Time.utc(2000, 1, 1, 4, 59, 59)) # 1 sec before midnight Jan 1 EST
assert_equal Date.new(1999, 12, 31), ActiveSupport::TimeZone['Eastern Time (US & Canada)'].today