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

en-AU locale updates #1964

Merged
merged 8 commits into from
May 20, 2020
21 changes: 21 additions & 0 deletions lib/faker/default/bank.rb
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,20 @@ def swift_bic
fetch('bank.swift_bic')
end

##
# Produces an Australian BSB (Bank-State-Branch) number
#
# @return [String]
#
# @example
# Faker::Bank.bsb_number
# #=> "036616"
#
# @faker.version next
def bsb_number
compile_bsb_number
end

private

def checksum(num_string)
Expand All @@ -130,6 +144,13 @@ def compile_routing_number
routing_num
end

def compile_bsb_number
digit_one_two = %w[01 03 06 08 11 12 73 76 78 30]
state = (2..7).to_a.map(&:to_s).sample
bsb_num = digit_one_two.sample + state + rand_numstring + rand_numstring + rand_numstring
bsb_num
end

# Calculates the mandatory checksum in 3rd and 4th characters in IBAN format
# source: https://en.wikipedia.org/wiki/International_Bank_Account_Number#Validating_the_IBAN
def iban_checksum(country_code, account)
Expand Down
10 changes: 5 additions & 5 deletions lib/faker/default/vehicle.rb
Original file line number Diff line number Diff line change
Expand Up @@ -268,17 +268,17 @@ def mileage(legacy_min = NOT_GIVEN, legacy_max = NOT_GIVEN, min: MILEAGE_MIN, ma
#
# @example
# Faker::Vehicle.license_plate #=> "DEP-2483"
# Faker::Vehicle.license_plate(state_abreviation: 'FL') #=> "977 UNU"
# Faker::Vehicle.license_plate(state_abbreviation: 'FL') #=> "977 UNU"
#
# @faker.version 1.6.4
def license_plate(legacy_state_abreviation = NOT_GIVEN, state_abreviation: '')
def license_plate(legacy_state_abreviation = NOT_GIVEN, state_abbreviation: '')
warn_for_deprecated_arguments do |keywords|
keywords << :state_abreviation if legacy_state_abreviation != NOT_GIVEN
keywords << :state_abbreviation if legacy_state_abreviation != NOT_GIVEN
end

return regexify(bothify(fetch('vehicle.license_plate'))) if state_abreviation.empty?
return regexify(bothify(fetch('vehicle.license_plate'))) if state_abbreviation.empty?

key = 'vehicle.license_plate_by_state.' + state_abreviation
key = 'vehicle.license_plate_by_state.' + state_abbreviation
regexify(bothify(fetch(key)))
end

Expand Down
54 changes: 44 additions & 10 deletions lib/locales/en-AU.yml
Original file line number Diff line number Diff line change
@@ -1,28 +1,62 @@
# Australia formatted data types
# Using Top 200 Australian baby names of 2010
# 286 Surnames familiar to Australian population
# Phone numbers use ACMA approved format
# https://www.acma.gov.au/use-phone-numbers-fiction
# Additional streets and secondary address formats
# https://auspost.com.au/content/dam/auspost_corp/media/documents/australia-post-data-guide.pdf

en-AU:
faker:
name:
prefix: [Mr, Mrs, Ms, Dr, Miss, Master]
first_name: [William, Jack, Oliver, Joshua, Thomas, Lachlan, Cooper, Noah, Ethan, Lucas, James, Samuel, Jacob, Liam, Alexander, Benjamin, Max, Isaac, Daniel, Riley, Ryan, Charlie, Tyler, Jake, Matthew, Xavier, Harry, Jayden, Nicholas, Harrison, Levi, Luke, Adam, Henry, Aiden, Dylan, Oscar, Michael, Jackson, Logan, Joseph, Blake, Nathan, Connor, Elijah, Nate, Archie, Bailey, Marcus, Cameron, Jordan, Zachary, Caleb, Hunter, Ashton, Toby, Aidan, Hayden, Mason, Hamish, Edward, Angus, Eli, Sebastian, Christian, Patrick, Andrew, Anthony, Luca, Kai, Beau, Alex, George, Callum, Finn, Zac, Mitchell, Jett, Jesse, Gabriel, Leo, Declan, Charles, Jasper, Jonathan, Aaron, Hugo, David, Christopher, Chase, Owen, Justin, Ali, Darcy, Lincoln, Cody, Phoenix, Sam, John, Joel, Isabella, Ruby, Chloe, Olivia, Charlotte, Mia, Lily, Emily, Ella, Sienna, Sophie, Amelia, Grace, Ava, Zoe, Emma, Sophia, Matilda, Hannah, Jessica, Lucy, Georgia, Sarah, Abigail, Zara, Eva, Scarlett, Jasmine, Chelsea, Lilly, Ivy, Isla, Evie, Isabelle, Maddison, Layla, Summer, Annabelle, Alexis, Elizabeth, Bella, Holly, Lara, Madison, Alyssa, Maya, Tahlia, Claire, Hayley, Imogen, Jade, Ellie, Sofia, Addison, Molly, Phoebe, Alice, Savannah, Gabriella, Kayla, Mikayla, Abbey, Eliza, Willow, Alexandra, Poppy, Samantha, Stella, Amy, Amelie, Anna, Piper, Gemma, Isabel, Victoria, Stephanie, Caitlin, Heidi, Paige, Rose, Amber, Audrey, Claudia, Taylor, Madeline, Angelina, Natalie, Charli, Lauren, Ashley, Violet, Mackenzie, Abby, Skye, Lillian, Alana, Lola, Leah, Eve, Kiara]
last_name: [Smith, Jones, Williams, Brown, Wilson, Taylor, Johnson, White, Martin, Anderson, Thompson, Nguyen, Thomas, Walker, Harris, Lee, Ryan, Robinson, Kelly, King, Davis, Wright, Evans, Roberts, Green, Hall, Wood, Jackson, Clarke, Patel, Khan, Lewis, James, Phillips, Mason, Mitchell, Rose, Davies, Rodriguez, Cox, Alexander, Garden, Campbell, Johnston, Moore, Smyth, O'neill, Doherty, Stewart, Quinn, Murphy, Graham, Mclaughlin, Hamilton, Murray, Hughes, Robertson, Thomson, Scott, Macdonald, Reid, Clark, Ross, Young, Watson, Paterson, Morrison, Morgan, Griffiths, Edwards, Rees, Jenkins, Owen, Price, Moss, Richards, Abbott, Adams, Armstrong, Bahringer, Bailey, Barrows, Bartell, Bartoletti, Barton, Bauch, Baumbach, Bayer, Beahan, Beatty, Becker, Beier, Berge, Bergstrom, Bode, Bogan, Borer, Bosco, Botsford, Boyer, Boyle, Braun, Bruen, Carroll, Carter, Cartwright, Casper, Cassin, Champlin, Christiansen, Cole, Collier, Collins, Connelly, Conroy, Corkery, Cormier, Corwin, Cronin, Crooks, Cruickshank, Cummings, D'amore, Daniel, Dare, Daugherty, Dickens, Dickinson, Dietrich, Donnelly, Dooley, Douglas, Doyle, Durgan, Ebert, Emard, Emmerich, Erdman, Ernser, Fadel, Fahey, Farrell, Fay, Feeney, Feil, Ferry, Fisher, Flatley, Gibson, Gleason, Glover, Goldner, Goodwin, Grady, Grant, Greenfelder, Greenholt, Grimes, Gutmann, Hackett, Hahn, Haley, Hammes, Hand, Hane, Hansen, Harber, Hartmann, Harvey, Hayes, Heaney, Heathcote, Heller, Hermann, Hermiston, Hessel, Hettinger, Hickle, Hill, Hills, Hoppe, Howe, Howell, Hudson, Huel, Hyatt, Jacobi, Jacobs, Jacobson, Jerde, Johns, Keeling, Kemmer, Kessler, Kiehn, Kirlin, Klein, Koch, Koelpin, Kohler, Koss, Kovacek, Kreiger, Kris, Kuhlman, Kuhn, Kulas, Kunde, Kutch, Lakin, Lang, Langworth, Larkin, Larson, Leannon, Leffler, Little, Lockman, Lowe, Lynch, Mann, Marks, Marvin, Mayer, Mccullough, Mcdermott, Mckenzie, Miller, Mills, Monahan, Morissette, Mueller, Muller, Nader, Nicolas, Nolan, O'connell, O'conner, O'hara, O'keefe, Olson, O'reilly, Parisian, Parker, Quigley, Reilly, Reynolds, Rice, Ritchie, Rohan, Rolfson, Rowe, Russel, Rutherford, Sanford, Sauer, Schmidt, Schmitt, Schneider, Schroeder, Schultz, Shields, Smitham, Spencer, Stanton, Stark, Stokes, Swift, Tillman, Towne, Tremblay, Tromp, Turcotte, Turner, Walsh, Walter, Ward, Waters, Weber, Welch, West, Wilderman, Wilkinson, Williamson, Windler, Wolf]
name_with_middle:
- "#{first_name} #{last_name} #{last_name}"
name_with_middle: ["#{first_name} #{last_name} #{last_name}", "#{first_name} #{first_name} #{last_name}"]
company:
suffix: [Pty Ltd, and Sons, Corp, Group, Brothers, Partners]
internet:
domain_suffix: [com.au, com, net.au, net, org.au, org]
domain_suffix: [com.au, com, net.au, net, org.au, org, edu.au, gov.au]
address:
state_abbr: [NSW, QLD, NT, SA, WA, TAS, ACT, VIC]
state: [New South Wales, Queensland, Northern Territory, South Australia, Western Australia, Tasmania, Australian Capital Territory, Victoria]
postcode: ['0###', '2###', '3###', '4###', '5###', '6###', '7###']
building_number: ['####', '###', '##']
street_suffix: [Avenue, Boulevard, Circle, Circuit, Court, Crescent, Crest, Drive, Estate Dr, Grove, Hill, Island, Junction, Knoll, Lane, Loop, Mall, Manor, Meadow, Mews, Parade, Parkway, Pass, Place, Plaza, Ridge, Road, Run, Square, Station St, Street, Summit, Terrace, Track, Trail, View Rd, Way]
default_country: [Australia]
postcode: ['02##', '08##', '####']
postcode_by_state:
ACT: ['02##','260#','261#','290#','291#']
NSW: ['1###', '2###']
NT: ['08##', '09##']
QLD: ['4###', '9###']
SA: ['5###']
TAS: ['7###']
VIC: ['3###','8###']
WA: ['6###']
building_number: ['####', '###', '##', '#/#', '##/#', '#?']
street_suffix: [Approach, Avenue, Arcade, Boulevard, Circle, Circuit, Court, Crescent, Crest, Drive, Estate, Entrance, Gardens, Grove, Green, Heights, Hill, Junction, Lane, Loop, Lookout, Mall, Mews, Mount, Parade, Park, Parkway, Pass, Place, Plaza, Promenade, Ramble, Ridge, Retreat, Rise, Road, Run, Square, Street, Summit, Terrace, Track, Trail, Turn, Way, View, Walk]
secondary_address: ['Apartment #', 'Apt #', 'Unit #', 'U#', 'Flat #', 'House #', 'Level #']
full_address: ["#{street_address}, #{city} #{postcode}", "#{street_address}, #{secondary_address}, #{city} #{postcode}", "#{secondary_address}, #{street_address}, #{city} #{postcode}", "#{mail_box} #{city} #{postcode}"]
country_code: AU
default_country: [Australia, Aus]
time_zone: [Australia/Sydney, Australia/Brisbane, Australia/Melbourne, Australia/Hobart, Australia/Adelaide, Australia/Perth, Australia/Darwin, Australia/Canberra]
country_code: '61'
phone_number:
formats: ['0# #### ####', '+61 # #### ####', '+61 4## ### ###'] #iOS AUS phone formats
area_code: ['02', '03', '07', '08']
subscriber_number: ['####']
formats: ["#{area_code} 7010 #{subscriber_number}", '7010 ####', "(#{area_code}) 7010 #{subscriber_number}", '5550 ####', "#{area_code} 5550 #{subscriber_number}", "(#{area_code}) 5550 #{subscriber_number}", "+#{country_code} #{area_code} 7010 #{subscriber_number}", "+#{country_code} #{area_code} 5550 #{subscriber_number}"]
cell_phone:
formats: ['04##-###-###', '(0) 4##-###-###', '04## ### ###', '04########', '04## ## ## ##']
formats: ['0491 570 006', '0491 570 156', '(04) 91570157', '0491 570 158', '0491 570 159', '0491570110', '0491 57 03 13', '0491 570 737', '0491 571 266', '0491 57 14 91', '0491 571 804', '0491 572 549', '0491 5726 65', '0491572983', '0491 573 770', '0491 573 087', '0491 574 118', '0491574632', '(04) 9157 5254', '0491 575 789', '0491 576 398', '0491576801', '0491 577 426', '0491577644', '0491 578 957', '0491 578 148', '0491 578 888', '0491 5792 12', '0491 579 760', '(04) 9157 9455']
team:
sport: ['basketball', 'football', 'footy', 'netball', 'rugby']
sport: [basketball, football, footy, netball, rugby, cricket, tennis, soccer, hockey, swimming, waterpolo, golf, AFL]
vehicle:
license_plate_by_state:
ACT: ['Y??##?']
NSW: ['??##??']
NT: ['??##??']
QLD: ['###???']
SA: ['S###???']
TAS: ['?##??']
VIC: ['#??#??']
WA: ['#???###']
university:
name: [University of South Australia, University of Tasmania, University of Technology Sydney, Australian National University, University of Melbourne, Monash University, University of Sydney, University of Queensland, The University of Western Australia, Curtin University, Murdoch University, University of Adelaide, Macquarie University, Deakin University, Griffith University, Flinders University, Edith Cowan University, Australia Catholic University, Charles Sturt University, University of New South Wales]
bank:
name: [ANZ, Westpac, Commonwealth Bank, National Australia Bank, St George Bank, Bank of Queensland, Bankwest, Bendigo Bank, Credit Union Australia, ING]
4 changes: 4 additions & 0 deletions test/faker/default/test_faker_bank.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ def test_routing_number_with_format
assert fraction.match(/\d{1,2}[-]\d{1,4}[\/]\d{1,4}/)
end

def test_bsb_number
assert Faker::Bank.bsb_number.match(/\d{6}/)
end

def test_account_number
assert Faker::Bank.account_number.match(/\d{10}/)

Expand Down
2 changes: 1 addition & 1 deletion test/faker/default/test_faker_vehicle.rb
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def test_license_plate
end

def test_license_plate_with_params
assert_match WORD_MATCH, @tester.license_plate(state_abreviation: 'CA')
assert_match WORD_MATCH, @tester.license_plate(state_abbreviation: 'CA')
end

def test_make
Expand Down
4 changes: 0 additions & 4 deletions test/test_en_au_locale.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,6 @@ def test_en_au_name_methods
assert Faker::Name.name_with_middle.is_a? String
end

def test_en_au_default_country
assert_equal 'Australia', Faker::Address.default_country
end

def test_aussie_mobiles_start_with_04
mobile = Faker::PhoneNumber.cell_phone.gsub(/\D/, '')
assert_equal '0', mobile[0]
Expand Down
4 changes: 2 additions & 2 deletions test/test_pt_br_locale.rb
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,8 @@ def test_pt_br_vehicle_methods
assert Faker::Vehicle.license_plate.is_a? String
assert Faker::Vehicle.license_plate.match(/^[A-Z]{3}\-[0-9]{4}/)

assert Faker::Vehicle.license_plate(state_abreviation: 'RJ').is_a? String
assert Faker::Vehicle.license_plate(state_abreviation: 'RJ').match(/^[A-Z]{3}\-[0-9]{4}/)
assert Faker::Vehicle.license_plate(state_abbreviation: 'RJ').is_a? String
assert Faker::Vehicle.license_plate(state_abbreviation: 'RJ').match(/^[A-Z]{3}\-[0-9]{4}/)
end

def test_pt_br_gender_methods
Expand Down