-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
Add Faker::Australia class #2245
Merged
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
826c0fc
Add initial test
astley92 ca2dc4f
Add Australia class and first method locations
astley92 5c4fff5
Add 50 australian locations
astley92 8163cd1
Add Australian animals
astley92 1cc8d81
Rename folder
astley92 a78f8aa
Add Australian States
astley92 227eef7
Fix typos
astley92 c8654bc
Fix more typos
astley92 fab0ae2
Fix spacing
astley92 263ce09
Merge branch 'faker-ruby:master' into master
astley92 b5d7424
Add faker version documentation
astley92 cf1c953
Merge branch 'master' of github.com:astley92/faker
astley92 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# 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 | ||
astley92 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
fetch('australia.locations') | ||
end | ||
|
||
# Produces an Australian animal | ||
# | ||
# @return [String] | ||
# | ||
# @example | ||
# Faker::Australia.animal | ||
# #=> "Dingo" | ||
# | ||
# @faker.version next | ||
def animal | ||
fetch('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') | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
en: | ||
faker: | ||
australia: | ||
locations: | ||
- Brisbane | ||
- Sydney | ||
- Melbourne | ||
- Brisbane | ||
- 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 | ||
- Visctoria | ||
- Tasmania |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# frozen_string_literal: true | ||
|
||
require_relative '../../test_helper' | ||
|
||
class TestFakerAustralia < Test::Unit::TestCase | ||
def setup | ||
@tester = Faker::Australia | ||
end | ||
|
||
def test_location | ||
assert @tester.location.match(/\w+/) | ||
end | ||
|
||
def test_animal | ||
assert @tester.animal.match(/\w+/) | ||
end | ||
|
||
def test_state | ||
assert @tester.state.match(/\w+/) | ||
end | ||
end |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should add this generator to the README.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We also need a
doc/default/australia.md
file.