aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test/time_zone_test.rb
diff options
context:
space:
mode:
authorAndrey Novikov <envek@envek.name>2015-06-18 23:13:15 +0300
committerAndrey Novikov <envek@envek.name>2016-04-19 21:53:04 +0300
commit318ee5413038fc33b302fcb4f41c146c8f10315f (patch)
tree5e757ed4ccec41bcd6312ecd8a75ed4209ff66e9 /activesupport/test/time_zone_test.rb
parent406a2380b88714387e015efcc0696bd2b20f49f1 (diff)
downloadrails-318ee5413038fc33b302fcb4f41c146c8f10315f.tar.gz
rails-318ee5413038fc33b302fcb4f41c146c8f10315f.tar.bz2
rails-318ee5413038fc33b302fcb4f41c146c8f10315f.zip
Add ActiveSupport::TimeZone.country_zones helper
That helper will return time zones for any country that tzdata knows about. So it will be much simpler for non-US people to list own country time zones in HTML selects or anywhere.
Diffstat (limited to 'activesupport/test/time_zone_test.rb')
-rw-r--r--activesupport/test/time_zone_test.rb5
1 files changed, 5 insertions, 0 deletions
diff --git a/activesupport/test/time_zone_test.rb b/activesupport/test/time_zone_test.rb
index 00d40c4497..d0674eb03a 100644
--- a/activesupport/test/time_zone_test.rb
+++ b/activesupport/test/time_zone_test.rb
@@ -491,6 +491,11 @@ class TimeZoneTest < ActiveSupport::TestCase
assert !ActiveSupport::TimeZone.us_zones.include?(ActiveSupport::TimeZone["Kuala Lumpur"])
end
+ def test_country_zones
+ assert ActiveSupport::TimeZone.country_zones("ru").include?(ActiveSupport::TimeZone["Moscow"])
+ assert !ActiveSupport::TimeZone.country_zones(:ru).include?(ActiveSupport::TimeZone["Kuala Lumpur"])
+ 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)