Skip to content

Commit

Permalink
Fix invalid IANA time zone identifier for Atlantic/Cape_Verde (#2927)
Browse files Browse the repository at this point in the history
* Add failing test

* Replace Atlantic/Cabo_Verde with the valid IANA time zone identifier Atlantic/Cape_Verde in en.faker.address.time_zone
  • Loading branch information
andrelaszlo committed Apr 19, 2024
1 parent 6db1e8f commit 8f01a57
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 1 deletion.
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,5 @@ gem 'rubocop-rake', '0.6.0'
gem 'simplecov', '0.22.0'
gem 'test-unit', '3.6.2'
gem 'timecop', '0.9.8'
gem 'tzinfo', '2.0.6'
gem 'yard', '0.9.36'
3 changes: 3 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ GEM
test-unit (3.6.2)
power_assert
timecop (0.9.8)
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
unicode-display_width (2.5.0)
yard (0.9.36)

Expand All @@ -78,6 +80,7 @@ DEPENDENCIES
simplecov (= 0.22.0)
test-unit (= 3.6.2)
timecop (= 0.9.8)
tzinfo (= 2.0.6)
yard (= 0.9.36)

BUNDLED WITH
Expand Down
2 changes: 1 addition & 1 deletion lib/locales/en/address.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1717,7 +1717,7 @@ en:
- America/Godthab
- Atlantic/South_Georgia
- Atlantic/Azores
- Atlantic/Cabo_Verde
- Atlantic/Cape_Verde
- Europe/Dublin
- Europe/London
- Europe/Lisbon
Expand Down
8 changes: 8 additions & 0 deletions test/test_en_locale.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# frozen_string_literal: true

require 'tzinfo'
require_relative 'test_helper'

class TestEnLocale < Test::Unit::TestCase
Expand Down Expand Up @@ -39,6 +40,13 @@ def test_values_trimmed
check_hash(en_file)
end

def test_en_timezones_are_valid_iana_identifiers
faker_time_zones = Faker::Address.translate('faker.address.time_zone')
iana_time_zones = TZInfo::Timezone.all_identifiers

assert_empty(faker_time_zones.difference(iana_time_zones), "Found a time zone that isn't a valid IANA time zone identifier")
end

def check_hash(hash)
hash.each { |key, value| check_value(value) unless key == 'separator' }
end
Expand Down

0 comments on commit 8f01a57

Please sign in to comment.