From d28c48243521a978ba8d432092e11a4aafb2b154 Mon Sep 17 00:00:00 2001 From: Andrew White Date: Tue, 28 Mar 2017 13:11:55 +0100 Subject: Return unmapped timezones from `country_zones` If a country doesn't exist in the MAPPINGS hash then create a new `ActiveSupport::Timezone` instance using the supplied timezone id. Fixes #28431. --- activesupport/test/time_zone_test.rb | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'activesupport/test/time_zone_test.rb') diff --git a/activesupport/test/time_zone_test.rb b/activesupport/test/time_zone_test.rb index 1615d8fdb2..de111cc40e 100644 --- a/activesupport/test/time_zone_test.rb +++ b/activesupport/test/time_zone_test.rb @@ -714,6 +714,10 @@ class TimeZoneTest < ActiveSupport::TestCase assert_not_includes ActiveSupport::TimeZone.country_zones(:ru), ActiveSupport::TimeZone["Kuala Lumpur"] end + def test_country_zones_without_mappings + assert_includes ActiveSupport::TimeZone.country_zones(:sv), ActiveSupport::TimeZone["America/El_Salvador"] + end + def test_to_yaml assert_equal("--- !ruby/object:ActiveSupport::TimeZone\nname: Pacific/Honolulu\n", ActiveSupport::TimeZone["Hawaii"].to_yaml) assert_equal("--- !ruby/object:ActiveSupport::TimeZone\nname: Europe/London\n", ActiveSupport::TimeZone["Europe/London"].to_yaml) -- cgit v1.2.3