From c6b2828d1d0ef8f867de40ca3a778f242374d1b1 Mon Sep 17 00:00:00 2001 From: Matt Didcoe Date: Thu, 16 Apr 2020 10:46:26 +0800 Subject: [PATCH 1/7] en-AU locale updates --- lib/locales/en-AU.yml | 66 +++++++++++++++++++++++++++++++++++---- test/test_en_au_locale.rb | 4 --- 2 files changed, 60 insertions(+), 10 deletions(-) diff --git a/lib/locales/en-AU.yml b/lib/locales/en-AU.yml index 2e3ed8327f..74f8787e76 100644 --- a/lib/locales/en-AU.yml +++ b/lib/locales/en-AU.yml @@ -1,6 +1,10 @@ # 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: @@ -9,6 +13,7 @@ en-AU: 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}" + - "#{first_name} #{first_name} #{last_name}" company: suffix: [Pty Ltd, and Sons, Corp, Group, Brothers, Partners] internet: @@ -16,13 +21,62 @@ en-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###'] + postcode: ['02##', '08##', '2###', '3###', '4###', '5###', '6###', '7###'] + postcode_by_state: + ACT: '02##' + NSW: '2###' + NT: '08##' + QLD: '4###' + SA: '5###' + TAS: '7###' + VIC: '3###' + WA: '6###' 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] + 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}" + 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'] + formats: + - "#{PhoneNumber.area_code} 7010 #{PhoneNumber.subscriber_number}" + - '7010 ####' + - "(#{PhoneNumber.area_code}) 7010 #{PhoneNumber.subscriber_number}" + - '5550 ####' + - "#{PhoneNumber.area_code} 5550 #{PhoneNumber.subscriber_number}" + - "(#{PhoneNumber.area_code}) 5550 #{PhoneNumber.subscriber_number}" cell_phone: - formats: ['04##-###-###', '(0) 4##-###-###', '04## ### ###', '04########', '04## ## ## ##'] + formats: ['0491 570 006', '0491 570 156', '0491 570 157', '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', '0491 577 644', '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' diff --git a/test/test_en_au_locale.rb b/test/test_en_au_locale.rb index 8e72f149d6..dacc5a0a15 100644 --- a/test/test_en_au_locale.rb +++ b/test/test_en_au_locale.rb @@ -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] From 58d5b2fc0fcaf6540a2c4d8cb0c7e69c1f3f9952 Mon Sep 17 00:00:00 2001 From: Matt Didcoe Date: Thu, 16 Apr 2020 10:53:55 +0800 Subject: [PATCH 2/7] en-AU locale update: added country code inclusive phone formats --- lib/locales/en-AU.yml | 36 +++++++++++++++++++++++++++++++----- 1 file changed, 31 insertions(+), 5 deletions(-) diff --git a/lib/locales/en-AU.yml b/lib/locales/en-AU.yml index 74f8787e76..84ba741877 100644 --- a/lib/locales/en-AU.yml +++ b/lib/locales/en-AU.yml @@ -17,11 +17,35 @@ en-AU: 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: ['02##', '08##', '2###', '3###', '4###', '5###', '6###', '7###'] + 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: + - '02##' + - '08##' + - '2###' + - '3###' + - '4###' + - '5###' + - '6###' + - '7###' postcode_by_state: ACT: '02##' NSW: '2###' @@ -68,8 +92,10 @@ en-AU: - '5550 ####' - "#{PhoneNumber.area_code} 5550 #{PhoneNumber.subscriber_number}" - "(#{PhoneNumber.area_code}) 5550 #{PhoneNumber.subscriber_number}" + - "+#{country_code} #{PhoneNumber.area_code} 7010 #{PhoneNumber.subscriber_number}" + - "+#{country_code} #{PhoneNumber.area_code} 5550 #{PhoneNumber.subscriber_number}" cell_phone: - formats: ['0491 570 006', '0491 570 156', '0491 570 157', '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', '0491 577 644', '0491 578 957', '0491 578 148', '0491 578 888', '0491 5792 12', '0491 579 760', '(04) 9157 9455'] + 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' From 3fccc93b1394d14bb91b42ea5a917e60be326b17 Mon Sep 17 00:00:00 2001 From: Matt Didcoe Date: Thu, 16 Apr 2020 10:55:27 +0800 Subject: [PATCH 3/7] en-AU locale update: added more common Australian sports --- lib/locales/en-AU.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/locales/en-AU.yml b/lib/locales/en-AU.yml index 84ba741877..7c5eecc96c 100644 --- a/lib/locales/en-AU.yml +++ b/lib/locales/en-AU.yml @@ -106,3 +106,8 @@ en-AU: - 'cricket' - 'tennis' - 'soccer' + - 'hockey' + - 'swimming' + - 'waterpolo' + - 'golf' + - 'AFL' From 2a63883c512269faaed2e89e738f8487ecdb1bd3 Mon Sep 17 00:00:00 2001 From: Matt Didcoe Date: Thu, 16 Apr 2020 15:02:03 +0800 Subject: [PATCH 4/7] Add method to generate an Australian format BSB number (inc. basic test); en-AU locale updates including name's for banks and universities, vehicle registration/license plates, postcode tweaks --- lib/faker/default/bank.rb | 21 ++++++++ lib/locales/en-AU.yml | 71 ++++++++++++++++++++++----- test/faker/default/test_faker_bank.rb | 4 ++ 3 files changed, 84 insertions(+), 12 deletions(-) diff --git a/lib/faker/default/bank.rb b/lib/faker/default/bank.rb index 613cbc3bc1..7d81b6b57f 100644 --- a/lib/faker/default/bank.rb +++ b/lib/faker/default/bank.rb @@ -46,6 +46,20 @@ def routing_number valid_routing_number 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 + def routing_number_with_format compile_fraction(valid_routing_number) end @@ -72,6 +86,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) diff --git a/lib/locales/en-AU.yml b/lib/locales/en-AU.yml index 7c5eecc96c..d68f228c2c 100644 --- a/lib/locales/en-AU.yml +++ b/lib/locales/en-AU.yml @@ -9,6 +9,13 @@ 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: @@ -40,22 +47,17 @@ en-AU: postcode: - '02##' - '08##' - - '2###' - - '3###' - - '4###' - - '5###' - - '6###' - - '7###' + - '####' postcode_by_state: - ACT: '02##' - NSW: '2###' - NT: '08##' - QLD: '4###' + ACT: ['02##','260#','261#','290#','291#'] + NSW: ['1###', '2###'] + NT: ['08##', '09##'] + QLD: ['4###', '9###'] SA: '5###' TAS: '7###' - VIC: '3###' + VIC: ['3###','8###'] WA: '6###' - building_number: ['####', '###', '##'] + 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 #' @@ -70,6 +72,7 @@ en-AU: - "#{street_address}, #{secondary_address}, #{city} #{postcode}" - "#{secondary_address}, #{street_address}, #{city} #{postcode}" - "#{mail_box} #{city} #{postcode}" + country_code: AU default_country: - Australia - Aus @@ -111,3 +114,47 @@ en-AU: - '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 \ No newline at end of file diff --git a/test/faker/default/test_faker_bank.rb b/test/faker/default/test_faker_bank.rb index 54e27ed966..f704c14396 100644 --- a/test/faker/default/test_faker_bank.rb +++ b/test/faker/default/test_faker_bank.rb @@ -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}/) From 2e7cb0f08e986909e2c7020bf108a7663ef70fb6 Mon Sep 17 00:00:00 2001 From: Matt Didcoe Date: Wed, 20 May 2020 14:22:04 +0800 Subject: [PATCH 5/7] Removed trailing white space on 114/128 --- lib/faker/default/bank.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/faker/default/bank.rb b/lib/faker/default/bank.rb index 6895a1736c..b8e45d3c7f 100644 --- a/lib/faker/default/bank.rb +++ b/lib/faker/default/bank.rb @@ -111,7 +111,7 @@ def routing_number_with_format def swift_bic fetch('bank.swift_bic') end - + ## # Produces an Australian BSB (Bank-State-Branch) number # @@ -125,7 +125,7 @@ def swift_bic def bsb_number compile_bsb_number end - + private def checksum(num_string) From 74ff9347aead9db3144d1208e0ac7c6af8cf6d2f Mon Sep 17 00:00:00 2001 From: Matt Didcoe Date: Wed, 20 May 2020 16:01:56 +0800 Subject: [PATCH 6/7] Taken onboard feedback from @psibi, also noted a spelling mistake in Faker::Vehicle while testing that is corrected in this update --- lib/faker/default/vehicle.rb | 10 +-- lib/locales/en-AU.yml | 148 ++++++----------------------------- 2 files changed, 30 insertions(+), 128 deletions(-) diff --git a/lib/faker/default/vehicle.rb b/lib/faker/default/vehicle.rb index 534bf36ddc..29e51069c3 100644 --- a/lib/faker/default/vehicle.rb +++ b/lib/faker/default/vehicle.rb @@ -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 diff --git a/lib/locales/en-AU.yml b/lib/locales/en-AU.yml index d68f228c2c..1ac6a94a03 100644 --- a/lib/locales/en-AU.yml +++ b/lib/locales/en-AU.yml @@ -9,152 +9,54 @@ en-AU: faker: name: - prefix: - - Mr - - Mrs - - Ms - - Dr - - Miss - - Master + 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}" - - "#{first_name} #{first_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, 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: - - '02##' - - '08##' - - '####' + 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: ['02##', '08##', '####'] postcode_by_state: ACT: ['02##','260#','261#','290#','291#'] NSW: ['1###', '2###'] NT: ['08##', '09##'] QLD: ['4###', '9###'] - SA: '5###' - TAS: '7###' + SA: ['5###'] + TAS: ['7###'] VIC: ['3###','8###'] - WA: '6###' + 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}" + 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 + 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: area_code: ['02', '03', '07', '08'] - formats: - - "#{PhoneNumber.area_code} 7010 #{PhoneNumber.subscriber_number}" - - '7010 ####' - - "(#{PhoneNumber.area_code}) 7010 #{PhoneNumber.subscriber_number}" - - '5550 ####' - - "#{PhoneNumber.area_code} 5550 #{PhoneNumber.subscriber_number}" - - "(#{PhoneNumber.area_code}) 5550 #{PhoneNumber.subscriber_number}" - - "+#{country_code} #{PhoneNumber.area_code} 7010 #{PhoneNumber.subscriber_number}" - - "+#{country_code} #{PhoneNumber.area_code} 5550 #{PhoneNumber.subscriber_number}" + 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: ['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' - - 'cricket' - - 'tennis' - - 'soccer' - - 'hockey' - - 'swimming' - - 'waterpolo' - - 'golf' - - 'AFL' + 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: '#???###' + 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 + 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 \ No newline at end of file + name: [ANZ, Westpac, Commonwealth Bank, National Australia Bank, St George Bank, Bank of Queensland, Bankwest, Bendigo Bank, Credit Union Australia, ING] \ No newline at end of file From c65cdb220cbef4a6e15d2e6b46e9e061a7ff4f9c Mon Sep 17 00:00:00 2001 From: Matt Didcoe Date: Wed, 20 May 2020 16:05:41 +0800 Subject: [PATCH 7/7] fixed tests using the misspelt state_abbreviation from Faker::Vehicle --- test/faker/default/test_faker_vehicle.rb | 2 +- test/test_pt_br_locale.rb | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/test/faker/default/test_faker_vehicle.rb b/test/faker/default/test_faker_vehicle.rb index 5cbecfe009..2958df6acc 100644 --- a/test/faker/default/test_faker_vehicle.rb +++ b/test/faker/default/test_faker_vehicle.rb @@ -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 diff --git a/test/test_pt_br_locale.rb b/test/test_pt_br_locale.rb index c5c5731376..b300698435 100644 --- a/test/test_pt_br_locale.rb +++ b/test/test_pt_br_locale.rb @@ -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