Skip to content

Commit

Permalink
Add Faker::Australia class (#2245)
Browse files Browse the repository at this point in the history
* Add initial test

* Add Australia class and first method locations

* Add 50 australian locations

* Add Australian animals

* Rename folder

* Add Australian States

* Fix typos

* Fix more typos

* Fix spacing

* Add faker version documentation
  • Loading branch information
astley92 committed Aug 21, 2021
1 parent 48d1608 commit a40905f
Show file tree
Hide file tree
Showing 3 changed files with 176 additions and 0 deletions.
47 changes: 47 additions & 0 deletions lib/faker/locations/australia.rb
@@ -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
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

0 comments on commit a40905f

Please sign in to comment.