From fcf41f1c6448f6b6309dc8959fb628e24ca53d1e Mon Sep 17 00:00:00 2001 From: Keshav Biswa Date: Tue, 19 Mar 2024 21:07:55 +0530 Subject: [PATCH] Update Faker::Australia to Faker::Locations::Australia (#2869) * update Faker::Australia to Faker::Locations::Australia * Bump minitest from 5.21.1 to 5.21.2 (#2894) Bumps [minitest](https://github.com/minitest/minitest) from 5.21.1 to 5.21.2. - [Changelog](https://github.com/minitest/minitest/blob/master/History.rdoc) - [Commits](https://github.com/minitest/minitest/compare/v5.21.1...v5.21.2) --- updated-dependencies: - dependency-name: minitest dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump rubocop from 1.59.0 to 1.60.2 (#2896) Bumps [rubocop](https://github.com/rubocop/rubocop) from 1.59.0 to 1.60.2. - [Release notes](https://github.com/rubocop/rubocop/releases) - [Changelog](https://github.com/rubocop/rubocop/blob/master/CHANGELOG.md) - [Commits](https://github.com/rubocop/rubocop/compare/v1.59.0...v1.60.2) --- updated-dependencies: - dependency-name: rubocop dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Add Kenya to supported countries (#2871) * Add Kenya to supported countries * Add tests for locale * clan up pull request * Add landline telephone numbers and cell phone formats * Bump minitest from 5.21.2 to 5.22.2 (#2902) Bumps [minitest](https://github.com/minitest/minitest) from 5.21.2 to 5.22.2. - [Changelog](https://github.com/minitest/minitest/blob/master/History.rdoc) - [Commits](https://github.com/minitest/minitest/compare/v5.21.2...v5.22.2) --- updated-dependencies: - dependency-name: minitest dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump test-unit from 3.6.1 to 3.6.2 (#2906) Bumps [test-unit](https://github.com/test-unit/test-unit) from 3.6.1 to 3.6.2. - [Release notes](https://github.com/test-unit/test-unit/releases) - [Commits](https://github.com/test-unit/test-unit/compare/3.6.1...3.6.2) --- updated-dependencies: - dependency-name: test-unit dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Refactor `Faker::IDNumber` to `Faker::IdNumber` to be more consistent with other generator's naming convention. (#2858) * Deprecate IDNumber to IdNumber per issue#2787 * wip * Add a Faker::Deprecator module Co-authored-by: Thiago Araujo * Add more specs and improve warning message --------- Co-authored-by: jamal.mohamed Co-authored-by: Stefanni Brasil Co-authored-by: Thiago Araujo * Fix/Deprecate FmaBrotherhood Generator (#2856) * Favor 'The Room' instead of 'Room' This commit will rename instances of room to the_room including the locales. Originally the `room.md` had a typo that referenced ::Room and not ::TheRoom which is also fixed here. Ref: - https://github.com/faker-ruby/faker/issues/2787 Co-authored-by: Jamal-A-Mohamed Co-authored-by: Salvador * Fix/Deprecate FmaBrotherhood Generator This commit fixes the naming discrpencies with the FmaBrotherhood (now FullmetalAlchemistBrotherhood) class and its filename. This adds deprecation warnings for the old FmaBrotherhood class and also makes the new FullmetalAlchemistBrotherhood class. Fix: - https://github.com/faker-ruby/faker/issues/2853 * Refactor deprecation for `FmaBrotherhood` This commit will refactor the changes from `FmaBrotherhood` to `FullmetalAlchemistBrotherhood` and use `Faker::Deprecator`. --------- Co-authored-by: Jamal-A-Mohamed Co-authored-by: Salvador Co-authored-by: Stefanni Brasil * Bump i18n from 1.14.1 to 1.14.4 (#2913) Bumps [i18n](https://github.com/ruby-i18n/i18n) from 1.14.1 to 1.14.4. - [Release notes](https://github.com/ruby-i18n/i18n/releases) - [Changelog](https://github.com/ruby-i18n/i18n/blob/master/CHANGELOG.md) - [Commits](https://github.com/ruby-i18n/i18n/compare/v1.14.1...v1.14.4) --- updated-dependencies: - dependency-name: i18n dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Remove duplicates in doc file (#2914) * Bump rubocop from 1.60.2 to 1.62.1 (#2916) Bumps [rubocop](https://github.com/rubocop/rubocop) from 1.60.2 to 1.62.1. - [Release notes](https://github.com/rubocop/rubocop/releases) - [Changelog](https://github.com/rubocop/rubocop/blob/master/CHANGELOG.md) - [Commits](https://github.com/rubocop/rubocop/compare/v1.60.2...v1.62.1) --- updated-dependencies: - dependency-name: rubocop dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump yard from 0.9.34 to 0.9.36 (#2909) Bumps [yard](https://github.com/lsegal/yard) from 0.9.34 to 0.9.36. - [Release notes](https://github.com/lsegal/yard/releases) - [Changelog](https://github.com/lsegal/yard/blob/main/CHANGELOG.md) - [Commits](https://github.com/lsegal/yard/compare/v0.9.34...v0.9.36) --- updated-dependencies: - dependency-name: yard dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Deprecated Faker::Australia * Added Docs for Australia * Updated Readme to include Locations * Updated locales path for australia * updated test to differentiate deprecated methods * Removed whitespaces from australia.yml --------- Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Andrew Nduati Co-authored-by: Jamal-A-Mohamed <37128483+Jamal-A-Mohamed@users.noreply.github.com> Co-authored-by: jamal.mohamed Co-authored-by: Stefanni Brasil Co-authored-by: Thiago Araujo Co-authored-by: Kirk Wang Co-authored-by: Jamal-A-Mohamed Co-authored-by: Salvador Co-authored-by: Michael Marusyk <31774981+mmarusyk@users.noreply.github.com> --- README.md | 6 + doc/locations/australia.md | 9 + lib/faker/locations/australia.rb | 81 +++---- lib/locales/en/australia.yml | 211 ++++++++++--------- test/faker/location/test_faker_australia.rb | 21 -- test/faker/locations/test_faker_australia.rb | 31 +++ test/test_determinism.rb | 1 + 7 files changed, 196 insertions(+), 164 deletions(-) create mode 100644 doc/locations/australia.md delete mode 100644 test/faker/location/test_faker_australia.rb create mode 100644 test/faker/locations/test_faker_australia.rb diff --git a/README.md b/README.md index 02aaa8ce02..104c93f2e3 100644 --- a/README.md +++ b/README.md @@ -477,6 +477,12 @@ gem 'faker', :git => 'https://github.com/faker-ruby/faker.git', :branch => 'main - [Faker::TvShows::VentureBros](doc/tv_shows/venture_bros.md) +
+ Locations + + - [Faker::Locations::Australia](doc/locations/australia.md) +
+ ## Contributing **Note**: We are not accepting proposals for new generators and locales. The [Contributing](CONTRIBUTING.md) guide has a few notes about this decision. diff --git a/doc/locations/australia.md b/doc/locations/australia.md new file mode 100644 index 0000000000..efa06a13ea --- /dev/null +++ b/doc/locations/australia.md @@ -0,0 +1,9 @@ +# Faker::Locations::Australia + +```ruby +Faker::Locations::Australia.location # => "Sydney" + +Faker::Locations::Australia.animal # => "Kangaroo" + +Faker::Locations::Australia.state # => "New South Wales" +``` diff --git a/lib/faker/locations/australia.rb b/lib/faker/locations/australia.rb index c0aeadf597..56ae93c9d0 100644 --- a/lib/faker/locations/australia.rb +++ b/lib/faker/locations/australia.rb @@ -1,47 +1,52 @@ # frozen_string_literal: true module Faker - class Australia < Base - class << self - ## - # Produces a location in Australia - # - # @return [String] - # - # @example - # Faker::Australia.location - # #=> "Sydney" - # - # @faker.version next - def location - fetch('australia.locations') - end + extend Deprecator - # Produces an Australian animal - # - # @return [String] - # - # @example - # Faker::Australia.animal - # #=> "Dingo" - # - # @faker.version next - def animal - fetch('australia.animals') - end + class Locations + class Australia < Base + class << self + ## + # Produces a location in Australia + # + # @return [String] + # + # @example + # Faker::Locations::Australia.location + # #=> "Sydney" + # + # @faker.version next + def location + fetch('locations.australia.locations') + end + + # Produces an Australian animal + # + # @return [String] + # + # @example + # Faker::Locations::Australia.animal + # #=> "Dingo" + # + # @faker.version next + def animal + fetch('locations.australia.animals') + end - # Produces an Australian State or Territory - # - # @return [String] - # - # @example - # Faker::Australia.state - # #=> "New South Wales" - # - # @faker.version next - def state - fetch('australia.states') + # Produces an Australian State or Territory + # + # @return [String] + # + # @example + # Faker::Locations::Australia.state + # #=> "New South Wales" + # + # @faker.version next + def state + fetch('locations.australia.states') + end end end end + deprecate_generator('Australia', Locations::Australia) end diff --git a/lib/locales/en/australia.yml b/lib/locales/en/australia.yml index 69864857c0..eb64d5be7f 100644 --- a/lib/locales/en/australia.yml +++ b/lib/locales/en/australia.yml @@ -1,107 +1,108 @@ en: faker: - australia: - locations: - - Brisbane - - Sydney - - Melbourne - - Perth - - Adelaide - - Gold Coast - - Newcastle - - Canberra - - Central Coast - - Sunshine Coast - - Wollongong - - Geelong - - Hobart - - Townsville - - Cairns - - Toowoomba - - Darwin - - Ballarat - - Bendigo - - Albury - - Launceston - - Mackay - - Rockhampton - - Bunbury - - Coffs Harbour - - Bundaberg - - Melton - - Wagga Wagga - - Hervey Bay - - Mildura – Wentworth - - Shepparton – Mooroopna - - Port Macquarie - - Gladstone – Tannum Sands - - Tamworth - - Traralgon – Morwell - - Orange - - Bowral – Mittagong - - Busselton - - Geraldton - - Dubbo - - Nowra – Bomaderry - - Warragul – Drouin - - Bathurst - - Warrnambool - - Albany - - Kalgoorlie - - Devonport - - Mount Gambier - - Lismore - - Nelson Bay - animals: - - Koala - - Humpback Whale - - Australian Fur Seal - - Wallaby - - Platypus - - Kangaroo - - Wombat - - Sugar Glider - - Flying Fox - - Tasmanian Devil - - Quokka - - Dugong - - Luaner - - Echidna - - Magpie - - Cockatoo - - Tawny Frogmouth - - Galah - - Lorikeet - - Pelican - - Cassowary - - Kookaburra - - Emu - - Lyrebird - - Barramundi - - Grouper - - Murray Cod - - Green Tree Frog - - Cane Toad - - Redback Spider - - Funnel Web Spider - - Blue Ringed Octopus - - Fresh Water Crocodile - - Skink - - Thorny Devil - - King Brown Snake - - Carpet Python - - Tiger Snake - - Red Bellied Black Snake - - Blue Tongue Lizard - - Frilled Neck Lizard - - Saltwater Crocodile - - Eastern Brown Snake - states: - - New South Wales - - Queensland - - Western Australia - - Northern Territory - - South Australia - - Australian Capital Territory - - Victoria - - Tasmania + locations: + australia: + locations: + - Brisbane + - Sydney + - Melbourne + - Perth + - Adelaide + - Gold Coast + - Newcastle + - Canberra + - Central Coast + - Sunshine Coast + - Wollongong + - Geelong + - Hobart + - Townsville + - Cairns + - Toowoomba + - Darwin + - Ballarat + - Bendigo + - Albury + - Launceston + - Mackay + - Rockhampton + - Bunbury + - Coffs Harbour + - Bundaberg + - Melton + - Wagga Wagga + - Hervey Bay + - Mildura – Wentworth + - Shepparton – Mooroopna + - Port Macquarie + - Gladstone – Tannum Sands + - Tamworth + - Traralgon – Morwell + - Orange + - Bowral – Mittagong + - Busselton + - Geraldton + - Dubbo + - Nowra – Bomaderry + - Warragul – Drouin + - Bathurst + - Warrnambool + - Albany + - Kalgoorlie + - Devonport + - Mount Gambier + - Lismore + - Nelson Bay + animals: + - Koala + - Humpback Whale + - Australian Fur Seal + - Wallaby + - Platypus + - Kangaroo + - Wombat + - Sugar Glider + - Flying Fox + - Tasmanian Devil + - Quokka + - Dugong + - Luaner + - Echidna + - Magpie + - Cockatoo + - Tawny Frogmouth + - Galah + - Lorikeet + - Pelican + - Cassowary + - Kookaburra + - Emu + - Lyrebird + - Barramundi + - Grouper + - Murray Cod + - Green Tree Frog + - Cane Toad + - Redback Spider + - Funnel Web Spider + - Blue Ringed Octopus + - Fresh Water Crocodile + - Skink + - Thorny Devil + - King Brown Snake + - Carpet Python + - Tiger Snake + - Red Bellied Black Snake + - Blue Tongue Lizard + - Frilled Neck Lizard + - Saltwater Crocodile + - Eastern Brown Snake + states: + - New South Wales + - Queensland + - Western Australia + - Northern Territory + - South Australia + - Australian Capital Territory + - Victoria + - Tasmania diff --git a/test/faker/location/test_faker_australia.rb b/test/faker/location/test_faker_australia.rb deleted file mode 100644 index 795da19ad6..0000000000 --- a/test/faker/location/test_faker_australia.rb +++ /dev/null @@ -1,21 +0,0 @@ -# frozen_string_literal: true - -require_relative '../../test_helper' - -class TestFakerAustralia < Test::Unit::TestCase - def setup - @tester = Faker::Australia - end - - def test_location - assert_match(/\w+/, @tester.location) - end - - def test_animal - assert_match(/\w+/, @tester.animal) - end - - def test_state - assert_match(/\w+/, @tester.state) - end -end diff --git a/test/faker/locations/test_faker_australia.rb b/test/faker/locations/test_faker_australia.rb new file mode 100644 index 0000000000..4e78113d62 --- /dev/null +++ b/test/faker/locations/test_faker_australia.rb @@ -0,0 +1,31 @@ +# frozen_string_literal: true + +require_relative '../../test_helper' + +class TestFakerLocationsAustralia < Test::Unit::TestCase + def test_location + assert_match(/\w+/, Faker::Locations::Australia.location) + end + + def test_animal + assert_match(/\w+/, Faker::Locations::Australia.animal) + end + + def test_state + assert_match(/\w+/, Faker::Locations::Australia.state) + end +end + +class TestFakerAustralia < Test::Unit::TestCase + def test_deprecated_location + assert_match(/\w+/, Faker::Australia.location) + end + + def test_deprecated_animal + assert_match(/\w+/, Faker::Australia.animal) + end + + def test_state + assert_match(/\w+/, Faker::Australia.state) + end +end diff --git a/test/test_determinism.rb b/test/test_determinism.rb index 69ddf28979..0dd805d125 100644 --- a/test/test_determinism.rb +++ b/test/test_determinism.rb @@ -102,6 +102,7 @@ def skipped_classes Internet JapaneseMedia LeagueOfLegends + Locations Movies Myst Overwatch