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

Add Faker::Australia class #2245

Merged
merged 12 commits into from Aug 21, 2021
47 changes: 47 additions & 0 deletions lib/faker/locations/australia.rb
@@ -0,0 +1,47 @@
# frozen_string_literal: true
Copy link
Member

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.

Copy link
Member

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.


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
108 changes: 108 additions & 0 deletions lib/locales/en/australia.yml
@@ -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
21 changes: 21 additions & 0 deletions test/faker/location/test_faker_australia.rb
@@ -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