ffaker 1.11.0 → 1.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Changelog.rdoc +108 -0
- data/README.rdoc +1 -68
- data/ffaker.gemspec +8 -4
- data/lib/ffaker.rb +3 -1
- data/lib/ffaker/address_au.rb +81 -0
- data/lib/ffaker/phone_number_au.rb +90 -0
- data/test/test_address_au.rb +55 -0
- data/test/test_phone_number_au.rb +53 -0
- metadata +10 -3
- data/History.txt +0 -30
data/Changelog.rdoc
ADDED
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
== 1.12.0
|
|
2
|
+
|
|
3
|
+
Faker::AddressAU and FakkerAddressPhoneAU modules (thanks Ben Wiseley).
|
|
4
|
+
|
|
5
|
+
== 1.11.0
|
|
6
|
+
|
|
7
|
+
Extraction of AddressUK and AddressUS classes. (Thanks doctorbh).
|
|
8
|
+
|
|
9
|
+
== 1.10.1
|
|
10
|
+
|
|
11
|
+
Faker::AddressCA (Thanks doctorbh, https://github.com/EmmanuelOga/ffaker/pull/27)
|
|
12
|
+
|
|
13
|
+
== 1.9.1
|
|
14
|
+
|
|
15
|
+
Faker::NameSN, Faker::PhoneNumberSN (Thanks SENE, https://github.com/EmmanuelOga/ffaker/pull/26)
|
|
16
|
+
|
|
17
|
+
Added Faker::NameJA (Thanks kichiro, https://github.com/EmmanuelOga/ffaker/pull/21)
|
|
18
|
+
|
|
19
|
+
== 1.8.1
|
|
20
|
+
|
|
21
|
+
Remove a warning.
|
|
22
|
+
|
|
23
|
+
== 1.8.0
|
|
24
|
+
|
|
25
|
+
Faker::HTMLIpsum module inspired in http://html-ipsum.com/ (Thanks Chris Bloom, https://github.com/EmmanuelOga/ffaker/pull/18)
|
|
26
|
+
|
|
27
|
+
== 1.7.0
|
|
28
|
+
|
|
29
|
+
Faker::LoremCN (Thanks Shane Weng, Shane Weng, https://github.com/swcool, https://github.com/EmmanuelOga/ffaker/pull/16/files)
|
|
30
|
+
|
|
31
|
+
== 1.6.0
|
|
32
|
+
|
|
33
|
+
Faker::NameDE (thanks David Noelte, https://github.com/marvin, https://github.com/EmmanuelOga/ffaker/pull/17)
|
|
34
|
+
Added Faker::Internet#disposable_email (Thanks Port 80 Labs, https://github.com/port80labs, https://github.com/EmmanuelOga/ffaker/pull/15)
|
|
35
|
+
|
|
36
|
+
== 1.5.0
|
|
37
|
+
|
|
38
|
+
Faker::NameRU (Thanks Vsevolod Romashov, https://github.com/7even, https://github.com/EmmanuelOga/ffaker/pull/14)
|
|
39
|
+
|
|
40
|
+
== 1.4.0
|
|
41
|
+
|
|
42
|
+
Faker::Product and Faker::Education (thanks Rico Sta. Cruz, https://github.com/EmmanuelOga/ffaker/pull/12 )
|
|
43
|
+
|
|
44
|
+
== 1.3.0
|
|
45
|
+
|
|
46
|
+
Faker::Lorem.word as a convenience method, instead of Faker::Lorem.words(1).first.
|
|
47
|
+
|
|
48
|
+
== 1.2.0
|
|
49
|
+
|
|
50
|
+
New Faker::NameCN module (contributions by qichunren)
|
|
51
|
+
|
|
52
|
+
Faker::NameCN.first_name # => 鑫洋
|
|
53
|
+
Faker::NameCN.last_name # => 禹
|
|
54
|
+
Faker::NameCN.name # => 俊伶漫
|
|
55
|
+
|
|
56
|
+
== 1.1.0
|
|
57
|
+
|
|
58
|
+
Api additions (contributions by Robert Berry)
|
|
59
|
+
|
|
60
|
+
Faker::Internet.uri(protocol)
|
|
61
|
+
Faker::Internet.http_url
|
|
62
|
+
Faker::Internet.ip_v4_address
|
|
63
|
+
|
|
64
|
+
== 0.4.0
|
|
65
|
+
|
|
66
|
+
Api additions by Rafael Souza
|
|
67
|
+
|
|
68
|
+
Faker::Geolocation.lat # => 40.6609944585817
|
|
69
|
+
Faker::Geolocation.lng # => -73.8454648940358
|
|
70
|
+
Faker::Address.neighborhood # => "Renton West"
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
== 0.3.3 2010-01-14
|
|
74
|
+
|
|
75
|
+
* removed library file and directory "faker". now you only can load the gem using require 'ffaker'
|
|
76
|
+
|
|
77
|
+
== 0.3.2 2010-01-14
|
|
78
|
+
|
|
79
|
+
* Several Optimizations, renamed gem packege to ffaker.
|
|
80
|
+
|
|
81
|
+
== 0.3.1 2008-04-03
|
|
82
|
+
|
|
83
|
+
1 minor enhancement:
|
|
84
|
+
|
|
85
|
+
* Added city to Address
|
|
86
|
+
|
|
87
|
+
== 0.3.0 2008-01-01
|
|
88
|
+
|
|
89
|
+
3 major enhancements:
|
|
90
|
+
|
|
91
|
+
* Added Lorem to generate fake Latin
|
|
92
|
+
* Added secondary_address to Address, and made inclusion of secondary address in street_address optional (false by default).
|
|
93
|
+
* Added UK address methods [Caius Durling]
|
|
94
|
+
|
|
95
|
+
== 0.2.1 2007-12-05
|
|
96
|
+
|
|
97
|
+
1 major enhancement:
|
|
98
|
+
|
|
99
|
+
* Dropped facets to avoid conflict with ActiveSupport
|
|
100
|
+
|
|
101
|
+
2 minor enhancements:
|
|
102
|
+
|
|
103
|
+
* Changed the output of user_name to randomly separate with a . or _
|
|
104
|
+
* Added a few tests
|
|
105
|
+
|
|
106
|
+
== 0.1.0 2007-11-22
|
|
107
|
+
|
|
108
|
+
* Initial release
|
data/README.rdoc
CHANGED
|
@@ -75,77 +75,10 @@ $ cat scripts/benchmark.rb
|
|
|
75
75
|
* SENE (https://github.com/PapePathe)
|
|
76
76
|
* kichiro (https://github.com/kichiro)
|
|
77
77
|
* doctorbh (https://github.com/doctorbh)
|
|
78
|
+
* Ben Wisleey ( https://github.com/wiseleyb )
|
|
78
79
|
|
|
79
80
|
* See complete list: https://github.com/EmmanuelOga/ffaker/network
|
|
80
81
|
|
|
81
|
-
== Changelog
|
|
82
|
-
|
|
83
|
-
* 1.11.0
|
|
84
|
-
|
|
85
|
-
Extraction of AddressUK and AddressUS classes. (Thanks doctorbh).
|
|
86
|
-
|
|
87
|
-
* 1.10.1
|
|
88
|
-
|
|
89
|
-
Added Faker::AddressCA (Thanks doctorbh, https://github.com/EmmanuelOga/ffaker/pull/27)
|
|
90
|
-
|
|
91
|
-
* 1.9.1
|
|
92
|
-
|
|
93
|
-
Added Faker::NameSN, Faker::PhoneNumberSN (Thanks SENE, https://github.com/EmmanuelOga/ffaker/pull/26)
|
|
94
|
-
Added Faker::NameJA (Thanks kichiro, https://github.com/EmmanuelOga/ffaker/pull/21)
|
|
95
|
-
|
|
96
|
-
* 1.8.1
|
|
97
|
-
|
|
98
|
-
Remove a warning.
|
|
99
|
-
|
|
100
|
-
* 1.8.0
|
|
101
|
-
|
|
102
|
-
Added Faker::HTMLIpsum module inspired in http://html-ipsum.com/ (Thanks Chris Bloom, https://github.com/EmmanuelOga/ffaker/pull/18)
|
|
103
|
-
|
|
104
|
-
* 1.7.0
|
|
105
|
-
|
|
106
|
-
Added Faker::LoremCN (Thanks Shane Weng, Shane Weng, https://github.com/swcool, https://github.com/EmmanuelOga/ffaker/pull/16/files)
|
|
107
|
-
|
|
108
|
-
* 1.6.0
|
|
109
|
-
|
|
110
|
-
Added Faker::NameDE (Thanks David Noelte, https://github.com/marvin, https://github.com/EmmanuelOga/ffaker/pull/17)
|
|
111
|
-
Added Faker::Internet#disposable_email (Thanks Port 80 Labs, https://github.com/port80labs, https://github.com/EmmanuelOga/ffaker/pull/15)
|
|
112
|
-
|
|
113
|
-
* 1.5.0
|
|
114
|
-
|
|
115
|
-
Added Faker::NameRU (Thanks Vsevolod Romashov, https://github.com/7even, https://github.com/EmmanuelOga/ffaker/pull/14)
|
|
116
|
-
|
|
117
|
-
* 1.4.0
|
|
118
|
-
|
|
119
|
-
Added Faker::Product and Faker::Education ( Thanks Rico Sta. Cruz, https://github.com/EmmanuelOga/ffaker/pull/12 )
|
|
120
|
-
|
|
121
|
-
* 1.3.0
|
|
122
|
-
|
|
123
|
-
Faker::Lorem.word as a convenience method, instead of Faker::Lorem.words(1).first.
|
|
124
|
-
|
|
125
|
-
* 1.2.0
|
|
126
|
-
|
|
127
|
-
New Faker::NameCN module (contributions by qichunren)
|
|
128
|
-
|
|
129
|
-
Faker::NameCN.first_name # => 鑫洋
|
|
130
|
-
Faker::NameCN.last_name # => 禹
|
|
131
|
-
Faker::NameCN.name # => 俊伶漫
|
|
132
|
-
|
|
133
|
-
* 1.1.0
|
|
134
|
-
|
|
135
|
-
Api additions (contributions by Robert Berry)
|
|
136
|
-
|
|
137
|
-
Faker::Internet.uri(protocol)
|
|
138
|
-
Faker::Internet.http_url
|
|
139
|
-
Faker::Internet.ip_v4_address
|
|
140
|
-
|
|
141
|
-
* 0.4.0
|
|
142
|
-
|
|
143
|
-
Api additions by Rafael Souza
|
|
144
|
-
|
|
145
|
-
Faker::Geolocation.lat # => 40.6609944585817
|
|
146
|
-
Faker::Geolocation.lng # => -73.8454648940358
|
|
147
|
-
Faker::Address.neighborhood # => "Renton West"
|
|
148
|
-
|
|
149
82
|
== TODO
|
|
150
83
|
|
|
151
84
|
* Even though the API is pretty simple, better rdoc documentation would not hurt.
|
data/ffaker.gemspec
CHANGED
|
@@ -5,8 +5,8 @@ Gem::Specification.new do |s|
|
|
|
5
5
|
s.rubygems_version = '1.3.5'
|
|
6
6
|
|
|
7
7
|
s.name = 'ffaker'
|
|
8
|
-
s.version = '1.
|
|
9
|
-
s.date = '2012-01-
|
|
8
|
+
s.version = '1.12.0'
|
|
9
|
+
s.date = '2012-01-07'
|
|
10
10
|
s.rubyforge_project = 'ffaker'
|
|
11
11
|
|
|
12
12
|
s.summary = "Faster Faker, generates dummy data."
|
|
@@ -19,17 +19,18 @@ Gem::Specification.new do |s|
|
|
|
19
19
|
s.require_paths = %w[lib]
|
|
20
20
|
|
|
21
21
|
s.rdoc_options = ["--charset=UTF-8"]
|
|
22
|
-
s.extra_rdoc_files = %w[README.rdoc LICENSE]
|
|
22
|
+
s.extra_rdoc_files = %w[README.rdoc LICENSE Changelog.rdoc]
|
|
23
23
|
|
|
24
24
|
# = MANIFEST =
|
|
25
25
|
s.files = %w[
|
|
26
|
-
|
|
26
|
+
Changelog.rdoc
|
|
27
27
|
LICENSE
|
|
28
28
|
README.rdoc
|
|
29
29
|
Rakefile
|
|
30
30
|
ffaker.gemspec
|
|
31
31
|
lib/ffaker.rb
|
|
32
32
|
lib/ffaker/address.rb
|
|
33
|
+
lib/ffaker/address_au.rb
|
|
33
34
|
lib/ffaker/address_ca.rb
|
|
34
35
|
lib/ffaker/address_de.rb
|
|
35
36
|
lib/ffaker/address_uk.rb
|
|
@@ -49,6 +50,7 @@ Gem::Specification.new do |s|
|
|
|
49
50
|
lib/ffaker/name_ru.rb
|
|
50
51
|
lib/ffaker/name_sn.rb
|
|
51
52
|
lib/ffaker/phone_number.rb
|
|
53
|
+
lib/ffaker/phone_number_au.rb
|
|
52
54
|
lib/ffaker/phone_number_sn.rb
|
|
53
55
|
lib/ffaker/product.rb
|
|
54
56
|
lib/ffaker/utils/array_utils.rb
|
|
@@ -58,6 +60,7 @@ Gem::Specification.new do |s|
|
|
|
58
60
|
scripts/profiling.rb
|
|
59
61
|
test/helper.rb
|
|
60
62
|
test/test_address.rb
|
|
63
|
+
test/test_address_au.rb
|
|
61
64
|
test/test_address_ca.rb
|
|
62
65
|
test/test_address_de.rb
|
|
63
66
|
test/test_address_uk.rb
|
|
@@ -79,6 +82,7 @@ Gem::Specification.new do |s|
|
|
|
79
82
|
test/test_lorem_cn.rb
|
|
80
83
|
test/test_module_utils.rb
|
|
81
84
|
test/test_phone_number.rb
|
|
85
|
+
test/test_phone_number_au.rb
|
|
82
86
|
test/test_phone_number_sn.rb
|
|
83
87
|
]
|
|
84
88
|
# = MANIFEST =
|
data/lib/ffaker.rb
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
module Faker
|
|
2
|
-
VERSION = "1.
|
|
2
|
+
VERSION = "1.12.0"
|
|
3
3
|
|
|
4
4
|
require 'ffaker/utils/array_utils'
|
|
5
5
|
require 'ffaker/utils/module_utils'
|
|
@@ -29,6 +29,7 @@ module Faker
|
|
|
29
29
|
autoload :AddressDE, 'ffaker/address_de'
|
|
30
30
|
autoload :AddressCA, 'ffaker/address_ca'
|
|
31
31
|
autoload :AddressUK, 'ffaker/address_uk'
|
|
32
|
+
autoload :AddressAU, 'ffaker/address_au'
|
|
32
33
|
autoload :Company, 'ffaker/company'
|
|
33
34
|
autoload :Education, 'ffaker/education'
|
|
34
35
|
autoload :Geolocation, 'ffaker/geolocation'
|
|
@@ -45,6 +46,7 @@ module Faker
|
|
|
45
46
|
autoload :NameSN, 'ffaker/name_sn'
|
|
46
47
|
autoload :PhoneNumber, 'ffaker/phone_number'
|
|
47
48
|
autoload :PhoneNumberSN, 'ffaker/phone_number_sn'
|
|
49
|
+
autoload :PhoneNumberAU, 'ffaker/phone_number_au'
|
|
48
50
|
autoload :Product, 'ffaker/product'
|
|
49
51
|
autoload :VERSION, 'ffaker/version'
|
|
50
52
|
end
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
# => author: wiseleyb
|
|
2
|
+
# => email: wiseleyb@gmail.com
|
|
3
|
+
module Faker
|
|
4
|
+
module AddressAU
|
|
5
|
+
include Faker::Address
|
|
6
|
+
extend ModuleUtils
|
|
7
|
+
extend self
|
|
8
|
+
|
|
9
|
+
def zip_code(st_abbr = nil)
|
|
10
|
+
st_abbr ||= state_abbr
|
|
11
|
+
ZIP_CODE[st_abbr][rand(ZIP_CODE[st_abbr].size)]
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def state
|
|
15
|
+
STATE.rand
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def state_abbr
|
|
19
|
+
STATE_ABBR.rand
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def city(st_abbr = nil)
|
|
23
|
+
st_abbr ||= state_abbr
|
|
24
|
+
CITY[st_abbr][rand(CITY[st_abbr].size)]
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def full_address(st_abbr = nil)
|
|
28
|
+
st_abbr ||= state_abbr
|
|
29
|
+
"#{Faker::Address.street_address}, #{city(st_abbr)}, #{st_abbr} #{zip_code}"
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
ZIP_FORMATS = k ['####']
|
|
33
|
+
|
|
34
|
+
# based on areas labeled state (+act) here: http://en.wikipedia.org/wiki/States_and_territories_of_Australia
|
|
35
|
+
STATE = k ['Australian Capital Territory', 'New South Wales', 'Queensland', 'South Australia', 'Tasmania', 'Victoria', 'Western Australia']
|
|
36
|
+
|
|
37
|
+
STATE_ABBR = k %w(ACT NSW NT QLD SA TAS VIC WA)
|
|
38
|
+
|
|
39
|
+
# based on http://en.wikipedia.org/wiki/List_of_cities_in_Australia
|
|
40
|
+
CITY = {
|
|
41
|
+
"ACT" => ["Canberra"],
|
|
42
|
+
"NSW" => ["Albury", "Armidale", "Bankstown", "Bathurst", "Blacktown", "Blue Mountains", "Botany Bay",
|
|
43
|
+
"Broken Hill", "Campbelltown", "Canada Bay", "Canterbury", "Cessnock", "Coffs Harbour", "Dubbo",
|
|
44
|
+
"Fairfield", "Gosford", "Goulburn", "Grafton", "Greater Taree", "Griffith", "Hawkesbury", "Holroyd",
|
|
45
|
+
"Hurstville", "Lake Macquarie", "Lismore", "Lithgow", "Liverpool", "Maitland", "Newcastle", "Orange",
|
|
46
|
+
"Parramatta", "Penrith", "Queanbeyan", "Randwick", "Rockdale", "Ryde", "Shellharbour", "Shoalhaven",
|
|
47
|
+
"Sydney", "Tamworth", "Wagga Wagga", "Willoughby", "Wollongong"],
|
|
48
|
+
"NT" => ["Darwin","Palmerston"],
|
|
49
|
+
"QLD" => ["Brisbane", "Bundaberg", "Cairns", "Caloundra", "Charters Towers", "Gladstone", "Gold Coast",
|
|
50
|
+
"Gympie", "Hervey Bay", "Ipswich", "Logan City", "Mackay", "Maryborough", "Mount Isa", "Redcliffe City",
|
|
51
|
+
"Redland City", "Rockhampton", "Sunshine Coast", "Surfers Paradise", "Thuringowa", "Toowoomba", "Townsville",
|
|
52
|
+
"Warwick"],
|
|
53
|
+
"SA" => ["Adelaide", "Mount Barker", "Mount Gambier", "Murray Bridge", "Port Adelaide", "Port Augusta",
|
|
54
|
+
"Port Lincoln", "Port Pirie", "Victor Harbor", "Whyalla"],
|
|
55
|
+
"TAS" => ["Burnie", "Clarence", "Devonport", "Glenorchy", "Hobart", "Launceston"],
|
|
56
|
+
"VIC" => ["Ararat", "Bairnsdale", "Ballarat", "Benalla", "Bendigo", "Dandenong", "Frankston", "Geelong",
|
|
57
|
+
"Hamilton", "Horsham", "Melbourne", "Melton", "Mildura", "Moe", "Morwell", "Sale", "Shepparton",
|
|
58
|
+
"Swan Hill", "Traralgon", "Wangaratta", "Warrnambool", "Wodonga"],
|
|
59
|
+
"WA" => ["Albany", "Armadale", "Bayswater", "Bunbury", "Canning", "Cockburn", "Fremantle", "Geraldton",
|
|
60
|
+
"Gosnells", "Joondalup", "Kalgoorlie", "Mandurah", "Melville", "Nedlands", "Perth", "Rockingham",
|
|
61
|
+
"South Perth", "Stirling", "Subiaco", "Swan", "Wanneroo"]
|
|
62
|
+
}
|
|
63
|
+
CITIES = CITY.keys.collect {|k| CITY[k]}.flatten.sort
|
|
64
|
+
|
|
65
|
+
# based on http://en.wikipedia.org/wiki/Postcodes_in_Australia
|
|
66
|
+
ZIP_CODE = {
|
|
67
|
+
"NSW" => [("1000".."1999").to_a + ("2000".."2599").to_a + ("2619".."2898").to_a + ("2921".."2999").to_a].flatten,
|
|
68
|
+
"ACT" => [("0200".."0299").to_a + ("2600".."2618").to_a + ("2900".."2920").to_a].flatten,
|
|
69
|
+
"VIC" => [("3000".."3999").to_a + ("8000".."8999").to_a].flatten,
|
|
70
|
+
"QLD" => [("4000".."4999").to_a + ("9000".."9999").to_a].flatten,
|
|
71
|
+
"SA" => [("5000".."5799").to_a + ("5800".."5999").to_a].flatten,
|
|
72
|
+
"WA" => [("6000".."6797").to_a + ("6800".."6999").to_a].flatten,
|
|
73
|
+
"TAS" => [("7000".."7799").to_a + ("7800".."7999").to_a].flatten,
|
|
74
|
+
"NT" => [("0800".."0899").to_a + ("0900".."0999").to_a].flatten
|
|
75
|
+
}
|
|
76
|
+
ZIP_CODES = ZIP_CODE.keys.collect {|k| ZIP_CODE[k]}.flatten.sort
|
|
77
|
+
|
|
78
|
+
end
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
# encoding: utf-8
|
|
2
|
+
|
|
3
|
+
# => author: wiseleyb
|
|
4
|
+
# => email: wiseleyb@gmail.com
|
|
5
|
+
# based on information from http://en.wikipedia.org/wiki/Telephone_numbers_in_Australia
|
|
6
|
+
module Faker
|
|
7
|
+
module PhoneNumberAU
|
|
8
|
+
extend ModuleUtils
|
|
9
|
+
extend self
|
|
10
|
+
|
|
11
|
+
# Prefixes from http://en.wikipedia.org/wiki/Telephone_numbers_in_Australia
|
|
12
|
+
# 00 Emergency and International access
|
|
13
|
+
# 01 Alternative phone services
|
|
14
|
+
# 02 Geographic: Central East region (NSW, ACT)
|
|
15
|
+
# 03 Geographic: South-east region (VIC, TAS)
|
|
16
|
+
# 04 Digital Mobile services (GSM and 3G)
|
|
17
|
+
# 05 Universal/Personal numberings
|
|
18
|
+
# 07 Geographic: North-east region (QLD)
|
|
19
|
+
# 08 Geographic: Central and West region (SA, NT, WA)
|
|
20
|
+
# 1 Non-geographic numbers (mostly for domestic use only)
|
|
21
|
+
|
|
22
|
+
# Mobile prefixes
|
|
23
|
+
MobileOperatorsPrefix = %w(04)
|
|
24
|
+
|
|
25
|
+
# Home or Work Operator prefixes
|
|
26
|
+
HomeWorkOperatorsPrefix = %w(02 03 05 07 08)
|
|
27
|
+
|
|
28
|
+
OperatorsPrefix = MobileOperatorsPrefix + HomeWorkOperatorsPrefix
|
|
29
|
+
|
|
30
|
+
# Return a prefix in MobileOperatorsPrefix
|
|
31
|
+
# @see Faker::PhoneNumberAU::MobileOperatorsPrefix
|
|
32
|
+
#
|
|
33
|
+
def mobile_phone_prefix
|
|
34
|
+
MobileOperatorsPrefix[rand(MobileOperatorsPrefix.size)]
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
# Return a prefix in HomeWorkOperatorsPrefix
|
|
38
|
+
# @see Faker::PhoneNumberAU::HomeWorkOperatorsPrefix
|
|
39
|
+
#
|
|
40
|
+
def home_work_phone_prefix
|
|
41
|
+
HomeWorkOperatorsPrefix[rand(HomeWorkOperatorsPrefix.size)]
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
def phone_prefix
|
|
45
|
+
OperatorsPrefix[rand(OperatorsPrefix.size)]
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
# Generates a general phone number
|
|
49
|
+
# (0x) xxxx xxxx
|
|
50
|
+
#
|
|
51
|
+
def home_work_phone_number
|
|
52
|
+
Faker.numerify("(#{home_work_phone_prefix}) #### ####")
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
# Generates a mobile phone number
|
|
56
|
+
# 04xx xxx xxx
|
|
57
|
+
#
|
|
58
|
+
def mobile_phone_number
|
|
59
|
+
Faker.numerify("#{mobile_phone_prefix}## ### ###")
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
# generates mobile or home/work number
|
|
63
|
+
def phone_number
|
|
64
|
+
case rand(2)
|
|
65
|
+
when 0 then home_work_phone_number
|
|
66
|
+
when 1 then mobile_phone_number
|
|
67
|
+
end
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
def country_code
|
|
71
|
+
"+61"
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
def international_mobile_phone_number
|
|
75
|
+
Faker.numerify("#{country_code} #{mobile_phone_prefix[1]} #### ####")
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
def international_home_work_phone_number
|
|
79
|
+
Faker.numerify("#{country_code} #{home_work_phone_prefix[1]} #### ####")
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
def international_phone_number
|
|
83
|
+
case rand(2)
|
|
84
|
+
when 0 then international_mobile_phone_number
|
|
85
|
+
when 1 then international_home_work_phone_number
|
|
86
|
+
end
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
end
|
|
90
|
+
end
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# => author: wiseleyb
|
|
2
|
+
# => email: wiseleyb@gmail.com
|
|
3
|
+
require 'helper'
|
|
4
|
+
|
|
5
|
+
class TestAddressAU < Test::Unit::TestCase
|
|
6
|
+
|
|
7
|
+
def test_au_state_abbr
|
|
8
|
+
arr = Faker::AddressAU::STATE_ABBR.sort
|
|
9
|
+
assert arr = Faker::AddressAU::CITY.keys.sort
|
|
10
|
+
assert arr = Faker::AddressAU::ZIP_CODE.keys.sort
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def test_au_state
|
|
14
|
+
assert_match /[ a-z]/, Faker::AddressAU.state
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def test_au_state_abbr
|
|
18
|
+
assert_match /[A-Z]/, Faker::AddressAU.state_abbr
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def test_au_city
|
|
22
|
+
assert_match /[a-zA-Z]/, Faker::AddressAU.city
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def test_zip_code
|
|
26
|
+
assert_match /\d{4}/, Faker::AddressAU.zip_code
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def test_full_address
|
|
30
|
+
assert_match /[\, a-z]/, Faker::AddressAU.full_address
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def test_zip_code_frozen
|
|
34
|
+
assert Faker::AddressAU.zip_code.frozen? == false
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def test_au_city_with_states
|
|
38
|
+
Faker::AddressAU::STATE_ABBR.each do |st_abbr|
|
|
39
|
+
assert_match /[a-zA-Z]/, Faker::AddressAU.city(st_abbr)
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
def test_zip_code_with_states
|
|
44
|
+
Faker::AddressAU::STATE_ABBR.each do |st_abbr|
|
|
45
|
+
assert_match /\d{4}/, Faker::AddressAU.zip_code(st_abbr)
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
def test_full_address_with_states
|
|
50
|
+
Faker::AddressAU::STATE_ABBR.each do |st_abbr|
|
|
51
|
+
assert_match /[\, a-z]/, Faker::AddressAU.full_address(st_abbr)
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
end
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# encoding: utf-8
|
|
2
|
+
|
|
3
|
+
# => author: wiseleyb
|
|
4
|
+
# => email: wiseleyb@gmail.com
|
|
5
|
+
require 'helper'
|
|
6
|
+
|
|
7
|
+
class TestPhoneNumberAU < Test::Unit::TestCase
|
|
8
|
+
def setup
|
|
9
|
+
@tester = Faker::PhoneNumberAU
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def test_mobile_phone_prefix
|
|
13
|
+
assert Faker::PhoneNumberAU::MobileOperatorsPrefix.include?(@tester.mobile_phone_prefix)
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def test_home_work_phone_prefix
|
|
17
|
+
assert Faker::PhoneNumberAU::HomeWorkOperatorsPrefix.include?(@tester.home_work_phone_prefix)
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def test_phone_prefix
|
|
21
|
+
assert Faker::PhoneNumberAU::OperatorsPrefix.include?(@tester.phone_prefix)
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def test_mobile_phone_number
|
|
25
|
+
assert_match /04\d{2} \d{3} \d{3}/, Faker::PhoneNumberAU.mobile_phone_number
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def test_home_work_phone_number
|
|
29
|
+
assert_match /\(\d{2}\) \d{4} \d{4}/, Faker::PhoneNumberAU.home_work_phone_number
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def test_phone_number
|
|
33
|
+
10.times do
|
|
34
|
+
assert_match /(04\d{2} \d{3} \d{3}|\(\d{2}\) \d{4} \d{4})/, Faker::PhoneNumberAU.phone_number
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def test_international_mobile_phone_number
|
|
39
|
+
assert_match /\+61 4 \d{4} \d{4}/, Faker::PhoneNumberAU.international_mobile_phone_number
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
def test_international_home_work_phone_number
|
|
43
|
+
assert_match /\+61 \d{1} \d{4} \d{4}/, Faker::PhoneNumberAU.international_home_work_phone_number
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
def test_international_phone_number
|
|
47
|
+
10.times do
|
|
48
|
+
assert_match /\+61 \d{1} \d{4} \d{4}/, Faker::PhoneNumberAU.international_phone_number
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
end
|
|
53
|
+
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: ffaker
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.12.0
|
|
5
5
|
prerelease:
|
|
6
6
|
platform: ruby
|
|
7
7
|
authors:
|
|
@@ -9,7 +9,7 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date: 2012-01-
|
|
12
|
+
date: 2012-01-07 00:00:00.000000000 Z
|
|
13
13
|
dependencies: []
|
|
14
14
|
description: Faster Faker, generates dummy data.
|
|
15
15
|
email: EmmanuelOga@gmail.com
|
|
@@ -18,14 +18,16 @@ extensions: []
|
|
|
18
18
|
extra_rdoc_files:
|
|
19
19
|
- README.rdoc
|
|
20
20
|
- LICENSE
|
|
21
|
+
- Changelog.rdoc
|
|
21
22
|
files:
|
|
22
|
-
-
|
|
23
|
+
- Changelog.rdoc
|
|
23
24
|
- LICENSE
|
|
24
25
|
- README.rdoc
|
|
25
26
|
- Rakefile
|
|
26
27
|
- ffaker.gemspec
|
|
27
28
|
- lib/ffaker.rb
|
|
28
29
|
- lib/ffaker/address.rb
|
|
30
|
+
- lib/ffaker/address_au.rb
|
|
29
31
|
- lib/ffaker/address_ca.rb
|
|
30
32
|
- lib/ffaker/address_de.rb
|
|
31
33
|
- lib/ffaker/address_uk.rb
|
|
@@ -45,6 +47,7 @@ files:
|
|
|
45
47
|
- lib/ffaker/name_ru.rb
|
|
46
48
|
- lib/ffaker/name_sn.rb
|
|
47
49
|
- lib/ffaker/phone_number.rb
|
|
50
|
+
- lib/ffaker/phone_number_au.rb
|
|
48
51
|
- lib/ffaker/phone_number_sn.rb
|
|
49
52
|
- lib/ffaker/product.rb
|
|
50
53
|
- lib/ffaker/utils/array_utils.rb
|
|
@@ -54,6 +57,7 @@ files:
|
|
|
54
57
|
- scripts/profiling.rb
|
|
55
58
|
- test/helper.rb
|
|
56
59
|
- test/test_address.rb
|
|
60
|
+
- test/test_address_au.rb
|
|
57
61
|
- test/test_address_ca.rb
|
|
58
62
|
- test/test_address_de.rb
|
|
59
63
|
- test/test_address_uk.rb
|
|
@@ -75,6 +79,7 @@ files:
|
|
|
75
79
|
- test/test_lorem_cn.rb
|
|
76
80
|
- test/test_module_utils.rb
|
|
77
81
|
- test/test_phone_number.rb
|
|
82
|
+
- test/test_phone_number_au.rb
|
|
78
83
|
- test/test_phone_number_sn.rb
|
|
79
84
|
homepage: http://github.com/emmanueloga/ffaker
|
|
80
85
|
licenses: []
|
|
@@ -103,6 +108,7 @@ specification_version: 2
|
|
|
103
108
|
summary: Faster Faker, generates dummy data.
|
|
104
109
|
test_files:
|
|
105
110
|
- test/test_address.rb
|
|
111
|
+
- test/test_address_au.rb
|
|
106
112
|
- test/test_address_ca.rb
|
|
107
113
|
- test/test_address_de.rb
|
|
108
114
|
- test/test_address_uk.rb
|
|
@@ -124,4 +130,5 @@ test_files:
|
|
|
124
130
|
- test/test_lorem_cn.rb
|
|
125
131
|
- test/test_module_utils.rb
|
|
126
132
|
- test/test_phone_number.rb
|
|
133
|
+
- test/test_phone_number_au.rb
|
|
127
134
|
- test/test_phone_number_sn.rb
|
data/History.txt
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
== 0.3.3 2010-01-14
|
|
2
|
-
* removed library file and directory "faker".
|
|
3
|
-
now you only can load the gem using require 'ffaker'
|
|
4
|
-
|
|
5
|
-
== 0.3.2 2010-01-14
|
|
6
|
-
* Several Optimizations, renamed gem packege to ffaker.
|
|
7
|
-
|
|
8
|
-
== 0.3.1 2008-04-03
|
|
9
|
-
* 1 minor enhancement:
|
|
10
|
-
* Added city to Address
|
|
11
|
-
|
|
12
|
-
== 0.3.0 2008-01-01
|
|
13
|
-
* 3 major enhancements:
|
|
14
|
-
* Added Lorem to generate fake Latin
|
|
15
|
-
* Added secondary_address to Address, and made inclusion of
|
|
16
|
-
secondary address in street_address optional (false by
|
|
17
|
-
default).
|
|
18
|
-
* Added UK address methods [Caius Durling]
|
|
19
|
-
|
|
20
|
-
== 0.2.1 2007-12-05
|
|
21
|
-
* 1 major enhancement:
|
|
22
|
-
* Dropped facets to avoid conflict with ActiveSupport
|
|
23
|
-
* 2 minor enhancements:
|
|
24
|
-
* Changed the output of user_name to randomly separate with a . or _
|
|
25
|
-
* Added a few tests
|
|
26
|
-
|
|
27
|
-
== 0.1.0 2007-11-22
|
|
28
|
-
|
|
29
|
-
* 1 major enhancement:
|
|
30
|
-
* Initial release
|