faker 1.6.1 → 1.6.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/History.txt +8 -0
- data/README.md +73 -2
- data/lib/faker.rb +19 -0
- data/lib/faker/beer.rb +39 -0
- data/lib/faker/boolean.rb +9 -0
- data/lib/faker/cat.rb +19 -0
- data/lib/faker/color.rb +4 -0
- data/lib/faker/commerce.rb +1 -1
- data/lib/faker/date.rb +8 -0
- data/lib/faker/internet.rb +4 -4
- data/lib/faker/star_wars.rb +67 -0
- data/lib/faker/superhero.rb +25 -0
- data/lib/faker/version.rb +1 -1
- data/lib/locales/ca-CAT.yml +24 -0
- data/lib/locales/ca.yml +25 -0
- data/lib/locales/da-DK.yml +69 -0
- data/lib/locales/en.yml +28 -3
- data/lib/locales/fi-FI.yml +29 -0
- data/lib/locales/pt.yml +58 -0
- data/test/test_ca_cat_locale.rb +35 -0
- data/test/test_ca_locale.rb +22 -0
- data/test/test_da_dk_locale.rb +32 -0
- data/test/test_faker_beer.rb +41 -0
- data/test/test_faker_boolean.rb +23 -0
- data/test/test_faker_cat.rb +20 -0
- data/test/test_faker_color.rb +4 -0
- data/test/test_faker_date.rb +11 -0
- data/test/test_faker_internet.rb +16 -0
- data/test/test_faker_number.rb +3 -3
- data/test/test_faker_star_wars.rb +74 -0
- data/test/test_faker_superhero.rb +16 -0
- data/test/test_fi_locale.rb +33 -0
- data/test/test_locale.rb +2 -0
- data/test/test_pt_locale.rb +27 -0
- metadata +33 -3
data/test/test_faker_number.rb
CHANGED
@@ -92,15 +92,15 @@ class TestFakerNumber < Test::Unit::TestCase
|
|
92
92
|
end
|
93
93
|
|
94
94
|
def test_insignificant_zero
|
95
|
-
|
95
|
+
@tester.stub :digit, 0 do
|
96
96
|
assert_equal '0', @tester.number(1)
|
97
97
|
100.times do
|
98
|
-
assert_match /^[1-9]0
|
98
|
+
assert_match (/^[1-9]0/), @tester.number(2)
|
99
99
|
end
|
100
100
|
|
101
101
|
assert_equal '0.0', @tester.decimal(1,1)
|
102
102
|
100.times do
|
103
|
-
assert_match /^0\.0[1-9]
|
103
|
+
assert_match (/^0\.0[1-9]/), @tester.decimal(1,2)
|
104
104
|
end
|
105
105
|
end
|
106
106
|
end
|
@@ -0,0 +1,74 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/test_helper.rb')
|
2
|
+
|
3
|
+
class TestFakerStarWars < Test::Unit::TestCase
|
4
|
+
def setup
|
5
|
+
@characters = Faker::StarWars.characters
|
6
|
+
@droids = Faker::StarWars.droids
|
7
|
+
@planets = Faker::StarWars.planets
|
8
|
+
@quotes = Faker::StarWars.quotes
|
9
|
+
@species = Faker::StarWars.species
|
10
|
+
@vehicles = Faker::StarWars.vehicles
|
11
|
+
end
|
12
|
+
|
13
|
+
def test_strings
|
14
|
+
assert @characters.size == 33
|
15
|
+
@characters.each do |character|
|
16
|
+
assert !character.nil?
|
17
|
+
assert character != ""
|
18
|
+
end
|
19
|
+
|
20
|
+
assert @droids.size == 21
|
21
|
+
@droids.each do |droid|
|
22
|
+
assert !droid.nil?
|
23
|
+
assert droid != ""
|
24
|
+
end
|
25
|
+
|
26
|
+
assert @planets.size == 20
|
27
|
+
@planets.each do |planet|
|
28
|
+
assert !planet.nil?
|
29
|
+
assert planet != ""
|
30
|
+
end
|
31
|
+
|
32
|
+
assert @quotes.size == 30
|
33
|
+
@quotes.each do |quote|
|
34
|
+
assert !quote.nil?
|
35
|
+
assert quote != ""
|
36
|
+
end
|
37
|
+
|
38
|
+
assert @species.size == 9
|
39
|
+
@species.each do |specie|
|
40
|
+
assert !specie.nil?
|
41
|
+
assert specie != ""
|
42
|
+
end
|
43
|
+
|
44
|
+
assert @vehicles.size == 21
|
45
|
+
@vehicles.each do |vehicle|
|
46
|
+
assert !vehicle.nil?
|
47
|
+
assert vehicle != ""
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
def test_character
|
52
|
+
assert Faker::StarWars.character.match(/\w+/)
|
53
|
+
end
|
54
|
+
|
55
|
+
def test_droid
|
56
|
+
assert Faker::StarWars.droid.match(/\w+/)
|
57
|
+
end
|
58
|
+
|
59
|
+
def test_planet
|
60
|
+
assert Faker::StarWars.planet.match(/\w+/)
|
61
|
+
end
|
62
|
+
|
63
|
+
def test_quote
|
64
|
+
assert Faker::StarWars.quote.match(/\w+/)
|
65
|
+
end
|
66
|
+
|
67
|
+
def test_specie
|
68
|
+
assert Faker::StarWars.specie.match(/\w+/)
|
69
|
+
end
|
70
|
+
|
71
|
+
def test_vehicle
|
72
|
+
assert Faker::StarWars.vehicle.match(/\w+/)
|
73
|
+
end
|
74
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/test_helper.rb')
|
2
|
+
|
3
|
+
class TestFakerSuperhero < Test::Unit::TestCase
|
4
|
+
|
5
|
+
def setup
|
6
|
+
@tester = Faker::Superhero
|
7
|
+
end
|
8
|
+
|
9
|
+
def test_power
|
10
|
+
assert @tester.power.match(/\w+\.?/)
|
11
|
+
end
|
12
|
+
|
13
|
+
def test_name
|
14
|
+
assert @tester.name.match(/\w+\.?/)
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/test_helper.rb')
|
2
|
+
|
3
|
+
class TesetEnLocale < Test::Unit::TestCase
|
4
|
+
def setup
|
5
|
+
Faker::Config.locale = 'fi-FI'
|
6
|
+
end
|
7
|
+
|
8
|
+
def teardown
|
9
|
+
Faker::Config.locale = nil
|
10
|
+
end
|
11
|
+
|
12
|
+
def test_fi_methods
|
13
|
+
assert Faker::Name.first_name_women.is_a? String
|
14
|
+
assert Faker::Name.first_name_men.is_a? String
|
15
|
+
assert Faker::Name.first_name.is_a? String
|
16
|
+
assert Faker::Name.last_name.is_a? String
|
17
|
+
assert Faker::Address.street_name.is_a? String
|
18
|
+
assert Faker::Address.city.is_a? String
|
19
|
+
end
|
20
|
+
|
21
|
+
def test_fi_phone_number
|
22
|
+
assert_match /0\d{2}[\-\s]?\d{6}/, Faker::PhoneNumber.cell_phone
|
23
|
+
assert_match /\d{2,3}[\s\-]?\d{5,6}/, Faker::PhoneNumber.phone_number
|
24
|
+
end
|
25
|
+
|
26
|
+
def test_fi_building_number
|
27
|
+
assert_match /^[\d]{1,3}$/, Faker::Address.building_number
|
28
|
+
end
|
29
|
+
|
30
|
+
def test_fi_post_code
|
31
|
+
assert_match /^[\d]{5}$/, Faker::Address.postcode
|
32
|
+
end
|
33
|
+
end
|
data/test/test_locale.rb
CHANGED
@@ -15,6 +15,8 @@ class TestLocale < Test::Unit::TestCase
|
|
15
15
|
Faker::Config.locale = :de
|
16
16
|
assert Faker::PhoneNumber.phone_number.match(/\(0\d+\) \d+|\+49-\d+-\d+/)
|
17
17
|
assert Faker::Address.street_name.match(//)
|
18
|
+
Faker::Config.locale = :ru
|
19
|
+
assert Faker::Internet.domain_name.match(/([\da-z\.-]+)\.([a-z\.]{2,6})/)
|
18
20
|
end
|
19
21
|
|
20
22
|
def test_configured_locale_translation
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/test_helper.rb')
|
2
|
+
|
3
|
+
class TestEsLocale < Test::Unit::TestCase
|
4
|
+
def setup
|
5
|
+
Faker::Config.locale = "pt"
|
6
|
+
end
|
7
|
+
|
8
|
+
def teardown
|
9
|
+
Faker::Config.locale = nil
|
10
|
+
end
|
11
|
+
|
12
|
+
def test_pl_phone_number
|
13
|
+
assert_match /^(\+351)?[\(\)\d\s\-]+$/, Faker::PhoneNumber.phone_number
|
14
|
+
end
|
15
|
+
|
16
|
+
def test_pl_building_number
|
17
|
+
assert_match /^[\d]{3,5}$/, Faker::Address.building_number
|
18
|
+
end
|
19
|
+
|
20
|
+
def test_pl_post_code
|
21
|
+
assert_match /^[\d]{4}$/, Faker::Address.postcode
|
22
|
+
end
|
23
|
+
|
24
|
+
def test_pl_secondary_address
|
25
|
+
assert_match /^[[:word:]]+[\.]? \d{1,3}$/, Faker::Address.secondary_address
|
26
|
+
end
|
27
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: faker
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.6.
|
4
|
+
version: 1.6.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Benjamin Curtis
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-02-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: i18n
|
@@ -41,9 +41,12 @@ files:
|
|
41
41
|
- lib/faker/address.rb
|
42
42
|
- lib/faker/app.rb
|
43
43
|
- lib/faker/avatar.rb
|
44
|
+
- lib/faker/beer.rb
|
44
45
|
- lib/faker/bitcoin.rb
|
45
46
|
- lib/faker/book.rb
|
47
|
+
- lib/faker/boolean.rb
|
46
48
|
- lib/faker/business.rb
|
49
|
+
- lib/faker/cat.rb
|
47
50
|
- lib/faker/code.rb
|
48
51
|
- lib/faker/color.rb
|
49
52
|
- lib/faker/commerce.rb
|
@@ -61,11 +64,16 @@ files:
|
|
61
64
|
- lib/faker/placeholdit.rb
|
62
65
|
- lib/faker/shakespeare.rb
|
63
66
|
- lib/faker/slack_emoji.rb
|
67
|
+
- lib/faker/star_wars.rb
|
68
|
+
- lib/faker/superhero.rb
|
64
69
|
- lib/faker/team.rb
|
65
70
|
- lib/faker/time.rb
|
66
71
|
- lib/faker/university.rb
|
67
72
|
- lib/faker/version.rb
|
68
73
|
- lib/helpers/char.rb
|
74
|
+
- lib/locales/ca-CAT.yml
|
75
|
+
- lib/locales/ca.yml
|
76
|
+
- lib/locales/da-DK.yml
|
69
77
|
- lib/locales/de-AT.yml
|
70
78
|
- lib/locales/de-CH.yml
|
71
79
|
- lib/locales/de.yml
|
@@ -83,6 +91,7 @@ files:
|
|
83
91
|
- lib/locales/en.yml
|
84
92
|
- lib/locales/es.yml
|
85
93
|
- lib/locales/fa.yml
|
94
|
+
- lib/locales/fi-FI.yml
|
86
95
|
- lib/locales/fr.yml
|
87
96
|
- lib/locales/he.yml
|
88
97
|
- lib/locales/it.yml
|
@@ -92,6 +101,7 @@ files:
|
|
92
101
|
- lib/locales/nl.yml
|
93
102
|
- lib/locales/pl.yml
|
94
103
|
- lib/locales/pt-BR.yml
|
104
|
+
- lib/locales/pt.yml
|
95
105
|
- lib/locales/ru.yml
|
96
106
|
- lib/locales/sk.yml
|
97
107
|
- lib/locales/sv.yml
|
@@ -101,6 +111,9 @@ files:
|
|
101
111
|
- lib/locales/zh-TW.yml
|
102
112
|
- test/test_array_sample_method_compat.rb
|
103
113
|
- test/test_avatar.rb
|
114
|
+
- test/test_ca_cat_locale.rb
|
115
|
+
- test/test_ca_locale.rb
|
116
|
+
- test/test_da_dk_locale.rb
|
104
117
|
- test/test_en_au_locale.rb
|
105
118
|
- test/test_en_au_ocker_locale.rb
|
106
119
|
- test/test_en_ca_locale.rb
|
@@ -111,9 +124,12 @@ files:
|
|
111
124
|
- test/test_es_locale.rb
|
112
125
|
- test/test_faker.rb
|
113
126
|
- test/test_faker_app.rb
|
127
|
+
- test/test_faker_beer.rb
|
114
128
|
- test/test_faker_bitcoin.rb
|
115
129
|
- test/test_faker_book.rb
|
130
|
+
- test/test_faker_boolean.rb
|
116
131
|
- test/test_faker_business.rb
|
132
|
+
- test/test_faker_cat.rb
|
117
133
|
- test/test_faker_city.rb
|
118
134
|
- test/test_faker_code.rb
|
119
135
|
- test/test_faker_color.rb
|
@@ -128,15 +144,19 @@ files:
|
|
128
144
|
- test/test_faker_number.rb
|
129
145
|
- test/test_faker_shakespeare.rb
|
130
146
|
- test/test_faker_slack_emoji.rb
|
147
|
+
- test/test_faker_star_wars.rb
|
131
148
|
- test/test_faker_street.rb
|
149
|
+
- test/test_faker_superhero.rb
|
132
150
|
- test/test_faker_team.rb
|
133
151
|
- test/test_faker_time.rb
|
134
152
|
- test/test_faker_university.rb
|
153
|
+
- test/test_fi_locale.rb
|
135
154
|
- test/test_flexible.rb
|
136
155
|
- test/test_helper.rb
|
137
156
|
- test/test_locale.rb
|
138
157
|
- test/test_pl_locale.rb
|
139
158
|
- test/test_placeholdit.rb
|
159
|
+
- test/test_pt_locale.rb
|
140
160
|
- test/test_uk_locale.rb
|
141
161
|
homepage: https://github.com/stympy/faker
|
142
162
|
licenses:
|
@@ -158,13 +178,16 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
158
178
|
version: '0'
|
159
179
|
requirements: []
|
160
180
|
rubyforge_project:
|
161
|
-
rubygems_version: 2.
|
181
|
+
rubygems_version: 2.4.5.1
|
162
182
|
signing_key:
|
163
183
|
specification_version: 4
|
164
184
|
summary: Easily generate fake data
|
165
185
|
test_files:
|
166
186
|
- test/test_array_sample_method_compat.rb
|
167
187
|
- test/test_avatar.rb
|
188
|
+
- test/test_ca_cat_locale.rb
|
189
|
+
- test/test_ca_locale.rb
|
190
|
+
- test/test_da_dk_locale.rb
|
168
191
|
- test/test_en_au_locale.rb
|
169
192
|
- test/test_en_au_ocker_locale.rb
|
170
193
|
- test/test_en_ca_locale.rb
|
@@ -175,9 +198,12 @@ test_files:
|
|
175
198
|
- test/test_es_locale.rb
|
176
199
|
- test/test_faker.rb
|
177
200
|
- test/test_faker_app.rb
|
201
|
+
- test/test_faker_beer.rb
|
178
202
|
- test/test_faker_bitcoin.rb
|
179
203
|
- test/test_faker_book.rb
|
204
|
+
- test/test_faker_boolean.rb
|
180
205
|
- test/test_faker_business.rb
|
206
|
+
- test/test_faker_cat.rb
|
181
207
|
- test/test_faker_city.rb
|
182
208
|
- test/test_faker_code.rb
|
183
209
|
- test/test_faker_color.rb
|
@@ -192,13 +218,17 @@ test_files:
|
|
192
218
|
- test/test_faker_number.rb
|
193
219
|
- test/test_faker_shakespeare.rb
|
194
220
|
- test/test_faker_slack_emoji.rb
|
221
|
+
- test/test_faker_star_wars.rb
|
195
222
|
- test/test_faker_street.rb
|
223
|
+
- test/test_faker_superhero.rb
|
196
224
|
- test/test_faker_team.rb
|
197
225
|
- test/test_faker_time.rb
|
198
226
|
- test/test_faker_university.rb
|
227
|
+
- test/test_fi_locale.rb
|
199
228
|
- test/test_flexible.rb
|
200
229
|
- test/test_helper.rb
|
201
230
|
- test/test_locale.rb
|
202
231
|
- test/test_pl_locale.rb
|
203
232
|
- test/test_placeholdit.rb
|
233
|
+
- test/test_pt_locale.rb
|
204
234
|
- test/test_uk_locale.rb
|