Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Faker::Australia to Faker::Locations::Australia #2869

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
382e49b
update Faker::Australia to Faker::Locations::Australia
keshavbiswa Dec 13, 2023
c54a349
Merge branch 'main' into keshav/update-australia-to-locations-australia
keshavbiswa Jan 22, 2024
d095a7c
Bump minitest from 5.21.1 to 5.21.2 (#2894)
dependabot[bot] Feb 2, 2024
18f4d3d
Bump rubocop from 1.59.0 to 1.60.2 (#2896)
dependabot[bot] Feb 2, 2024
9e004ca
Add Kenya to supported countries (#2871)
AndrewNduati Feb 5, 2024
d0aef26
Bump minitest from 5.21.2 to 5.22.2 (#2902)
dependabot[bot] Feb 22, 2024
d62b619
Bump test-unit from 3.6.1 to 3.6.2 (#2906)
dependabot[bot] Feb 22, 2024
dea4fd7
Refactor `Faker::IDNumber` to `Faker::IdNumber` to be more consistent…
Jamal-A-Mohamed Feb 25, 2024
964a223
Fix/Deprecate FmaBrotherhood Generator (#2856)
kirkkwang Feb 26, 2024
08801ce
Bump i18n from 1.14.1 to 1.14.4 (#2913)
dependabot[bot] Mar 13, 2024
ebd93ab
Remove duplicates in doc file (#2914)
mmarusyk Mar 13, 2024
b03b2cc
Bump rubocop from 1.60.2 to 1.62.1 (#2916)
dependabot[bot] Mar 13, 2024
7f05e48
Bump yard from 0.9.34 to 0.9.36 (#2909)
dependabot[bot] Mar 13, 2024
8cb3f4f
Deprecated Faker::Australia
keshavbiswa Mar 17, 2024
bdc58b2
Merge branch 'main' into keshav/update-australia-to-locations-australia
keshavbiswa Mar 17, 2024
783b8a9
Added Docs for Australia
keshavbiswa Mar 18, 2024
7df8a08
Updated Readme to include Locations
keshavbiswa Mar 18, 2024
69d845f
Merge branch 'main' into keshav/update-australia-to-locations-australia
keshavbiswa Mar 18, 2024
9d69731
Updated locales path for australia
keshavbiswa Mar 19, 2024
865bddf
updated test to differentiate deprecated methods
keshavbiswa Mar 19, 2024
2c9ab80
Merge branch 'main' into keshav/update-australia-to-locations-australia
keshavbiswa Mar 19, 2024
391399c
Removed whitespaces from australia.yml
keshavbiswa Mar 19, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
</details>

<details>
keshavbiswa marked this conversation as resolved.
Show resolved Hide resolved
<summary>Locations</summary>

- [Faker::Locations::Australia](doc/locations/australia.md)
</details>

## Contributing

**Note**: We are not accepting proposals for new generators and locales. The [Contributing](CONTRIBUTING.md) guide has a few notes about this decision.
Expand Down
9 changes: 9 additions & 0 deletions doc/locations/australia.md
Original file line number Diff line number Diff line change
@@ -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"
```
81 changes: 43 additions & 38 deletions lib/faker/locations/australia.rb
Original file line number Diff line number Diff line change
@@ -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')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

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
211 changes: 106 additions & 105 deletions lib/locales/en/australia.yml
Original file line number Diff line number Diff line change
@@ -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
21 changes: 0 additions & 21 deletions test/faker/location/test_faker_australia.rb

This file was deleted.

31 changes: 31 additions & 0 deletions test/faker/locations/test_faker_australia.rb
Original file line number Diff line number Diff line change
@@ -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
keshavbiswa marked this conversation as resolved.
Show resolved Hide resolved
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
1 change: 1 addition & 0 deletions test/test_determinism.rb
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ def skipped_classes
Internet
JapaneseMedia
LeagueOfLegends
Locations
Movies
Myst
Overwatch
Expand Down