Update to Rails 2.3.8

This commit is contained in:
Jacques Distler 2010-05-25 12:45:45 -05:00
parent 6677b46cb4
commit f0635301aa
429 changed files with 17683 additions and 4047 deletions

View file

@ -39,9 +39,8 @@ class TimeZoneTest < Test::Unit::TestCase
assert_instance_of ActiveSupport::TimeZone, ActiveSupport::TimeZone[zone.name]
end
define_method("test_utc_offset_for_#{name}") do
period = zone.tzinfo.current_period
assert_equal period.utc_offset, zone.utc_offset
define_method("test_zones_map_for_#{name}") do
assert_equal ActiveSupport::TimeZone.zones_map[zone.name], zone
end
end
@ -74,6 +73,21 @@ class TimeZoneTest < Test::Unit::TestCase
end
end
def test_unknown_timezones_delegation_to_tzinfo
zone = ActiveSupport::TimeZone['America/Montevideo']
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
end
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