faker 1.4.3 → 1.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/History.txt +13 -0
- data/README.md +167 -11
- data/lib/faker.rb +6 -0
- data/lib/faker/avatar.rb +2 -2
- data/lib/faker/bitcoin.rb +17 -5
- data/lib/faker/book.rb +19 -0
- data/lib/faker/business.rb +1 -1
- data/lib/faker/code.rb +7 -0
- data/lib/faker/color.rb +49 -0
- data/lib/faker/commerce.rb +5 -1
- data/lib/faker/company.rb +42 -4
- data/lib/faker/internet.rb +18 -19
- data/lib/faker/slack_emoji.rb +43 -0
- data/lib/faker/team.rb +1 -1
- data/lib/faker/university.rb +20 -0
- data/lib/faker/version.rb +1 -1
- data/lib/helpers/char.rb +44 -0
- data/lib/locales/en-AU.yml +2 -0
- data/lib/locales/en-CA.yml +2 -2
- data/lib/locales/en-UG.yml +128 -0
- data/lib/locales/en-US.yml +1 -1
- data/lib/locales/en.yml +43 -9
- data/lib/locales/nb-NO.yml +1 -1
- data/lib/locales/nl.yml +15 -15
- data/lib/locales/pl.yml +2 -2
- data/lib/locales/ru.yml +4 -4
- data/lib/locales/sk.yml +1 -1
- data/lib/locales/sv.yml +4 -4
- data/lib/locales/uk.yml +75 -0
- data/lib/locales/zh-CN.yml +5 -5
- data/lib/locales/zh-TW.yml +27 -0
- data/test/test_avatar.rb +4 -1
- data/test/test_en_ca_locale.rb +18 -0
- data/test/test_en_ug_locale.rb +23 -0
- data/test/test_faker_bitcoin.rb +5 -0
- data/test/test_faker_book.rb +20 -0
- data/test/test_faker_business.rb +11 -10
- data/test/test_faker_code.rb +4 -0
- data/test/test_faker_color.rb +46 -0
- data/test/test_faker_commerce.rb +4 -0
- data/test/test_faker_company.rb +12 -1
- data/test/test_faker_internet.rb +4 -0
- data/test/test_faker_slack_emoji.rb +45 -0
- data/test/test_faker_team.rb +12 -0
- data/test/test_faker_time.rb +1 -1
- data/test/test_faker_university.rb +20 -0
- data/test/test_uk_locale.rb +44 -0
- metadata +26 -4
data/test/test_faker_commerce.rb
CHANGED
@@ -59,6 +59,10 @@ class TestFakerCommerce < Test::Unit::TestCase
|
|
59
59
|
assert @tester.product_name.match(/[A-Z][a-z]+\.?/)
|
60
60
|
end
|
61
61
|
|
62
|
+
def test_material
|
63
|
+
assert @tester.material.match(/[A-Z][a-z]+\.?/)
|
64
|
+
end
|
65
|
+
|
62
66
|
def test_price
|
63
67
|
assert_includes 0..100, @tester.price
|
64
68
|
end
|
data/test/test_faker_company.rb
CHANGED
@@ -14,6 +14,17 @@ class TestFakerCompany < Test::Unit::TestCase
|
|
14
14
|
end
|
15
15
|
|
16
16
|
def test_logo
|
17
|
-
|
17
|
+
assert @tester.logo.match(%r{http://pigment.github.io/fake-logos/logos/medium/color/\d+\.png})
|
18
18
|
end
|
19
|
+
|
20
|
+
def test_buzzword
|
21
|
+
assert @tester.buzzword.match(/\w+\.?/)
|
22
|
+
end
|
23
|
+
|
24
|
+
def test_swedish_organisation_number
|
25
|
+
org_no = @tester.swedish_organisation_number
|
26
|
+
assert org_no.match(/\d{10}/)
|
27
|
+
assert org_no[9] == @tester.send(:luhn_algorithm, org_no[0..8]).to_s
|
28
|
+
end
|
29
|
+
|
19
30
|
end
|
data/test/test_faker_internet.rb
CHANGED
@@ -134,4 +134,8 @@ class TestFakerInternet < Test::Unit::TestCase
|
|
134
134
|
def test_url
|
135
135
|
assert @tester.url('domain.com', '/username').match(/^http:\/\/domain\.com\/username$/)
|
136
136
|
end
|
137
|
+
|
138
|
+
def test_device_token
|
139
|
+
assert_equal 64, @tester.device_token.size
|
140
|
+
end
|
137
141
|
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/test_helper.rb')
|
2
|
+
|
3
|
+
class TestFakerSlackEmoji < Test::Unit::TestCase
|
4
|
+
|
5
|
+
def setup
|
6
|
+
@tester = Faker::SlackEmoji
|
7
|
+
@emoticon_regex= /^:([\w-]+):$/
|
8
|
+
end
|
9
|
+
|
10
|
+
def test_people
|
11
|
+
assert @tester.people.match(@emoticon_regex)
|
12
|
+
end
|
13
|
+
|
14
|
+
def test_nature
|
15
|
+
assert @tester.nature.match(@emoticon_regex)
|
16
|
+
end
|
17
|
+
|
18
|
+
def test_food_and_drink
|
19
|
+
assert @tester.food_and_drink.match(@emoticon_regex)
|
20
|
+
end
|
21
|
+
|
22
|
+
def test_celebration
|
23
|
+
assert @tester.celebration.match(@emoticon_regex)
|
24
|
+
end
|
25
|
+
|
26
|
+
def test_activity
|
27
|
+
assert @tester.activity.match(@emoticon_regex)
|
28
|
+
end
|
29
|
+
|
30
|
+
def test_travel_and_places
|
31
|
+
assert @tester.travel_and_places.match(@emoticon_regex)
|
32
|
+
end
|
33
|
+
|
34
|
+
def test_objects_and_symbols
|
35
|
+
assert @tester.objects_and_symbols.match(@emoticon_regex)
|
36
|
+
end
|
37
|
+
|
38
|
+
def test_custom
|
39
|
+
assert @tester.custom.match(@emoticon_regex)
|
40
|
+
end
|
41
|
+
|
42
|
+
def test_emoji
|
43
|
+
assert @tester.emoji.match(@emoticon_regex)
|
44
|
+
end
|
45
|
+
end
|
data/test/test_faker_team.rb
CHANGED
@@ -10,4 +10,16 @@ class TestFakerTeam < Test::Unit::TestCase
|
|
10
10
|
assert @tester.name.match(/(\w+\.? ?){2}/)
|
11
11
|
end
|
12
12
|
|
13
|
+
def test_creature
|
14
|
+
assert @tester.creature.match(/(\w+){1}/)
|
15
|
+
end
|
16
|
+
|
17
|
+
def test_state
|
18
|
+
assert @tester.state.match(/(\w+){1}/)
|
19
|
+
end
|
20
|
+
|
21
|
+
def test_sport
|
22
|
+
assert @tester.sport.match(/(\w+){1}/)
|
23
|
+
end
|
24
|
+
|
13
25
|
end
|
data/test/test_faker_time.rb
CHANGED
@@ -67,7 +67,7 @@ class TestFakerTime < Test::Unit::TestCase
|
|
67
67
|
random_forward = @tester.forward(30, period)
|
68
68
|
|
69
69
|
[random_backward, random_between, random_forward].each do |result|
|
70
|
-
assert period_range.include?(result.hour), "\"#{result.hour}\" expected to be included in Faker::Time::TIME_RANGES[:#{period}] range"
|
70
|
+
assert period_range.include?(result.hour.to_i), "\"#{result.hour}\" expected to be included in Faker::Time::TIME_RANGES[:#{period}] range"
|
71
71
|
end
|
72
72
|
end
|
73
73
|
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/test_helper.rb')
|
2
|
+
|
3
|
+
class TestFakerUniversity < Test::Unit::TestCase
|
4
|
+
def setup
|
5
|
+
@tester = Faker::University
|
6
|
+
end
|
7
|
+
|
8
|
+
def test_prefix
|
9
|
+
assert @tester.prefix.match(/\w+\.?/)
|
10
|
+
end
|
11
|
+
|
12
|
+
def test_suffix
|
13
|
+
assert @tester.suffix.match(/\w+\.?/)
|
14
|
+
end
|
15
|
+
|
16
|
+
def test_name
|
17
|
+
assert @tester.name.match(/\w+\.?/)
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/test_helper.rb')
|
2
|
+
|
3
|
+
class TestUkLocale < Test::Unit::TestCase
|
4
|
+
def setup
|
5
|
+
@previous_locale = Faker::Config.locale
|
6
|
+
Faker::Config.locale = "uk"
|
7
|
+
end
|
8
|
+
|
9
|
+
def teardown
|
10
|
+
Faker::Config.locale = @previous_locale
|
11
|
+
end
|
12
|
+
|
13
|
+
def test_uk_email_at_symbol_is_not_followed_by_dot
|
14
|
+
assert Faker::Internet.email.match(/.+@[^.].+\.\w+/)
|
15
|
+
end
|
16
|
+
|
17
|
+
def test_uk_domain_word_returns_latin_chars
|
18
|
+
assert Faker::Internet.domain_word.match(/^\w+$/)
|
19
|
+
end
|
20
|
+
|
21
|
+
def test_uk_zipcode_length
|
22
|
+
assert Faker::Address.zip_code.match(/^\d{5}$/)
|
23
|
+
end
|
24
|
+
|
25
|
+
def test_uk_street_prefix_returns_true_value
|
26
|
+
assert_send([Faker::Address, :street_prefix])
|
27
|
+
end
|
28
|
+
|
29
|
+
def test_uk_city_prefix_absent
|
30
|
+
assert_equal("", Faker::Address.city_prefix)
|
31
|
+
end
|
32
|
+
|
33
|
+
def test_uk_city_suffix_absent
|
34
|
+
assert_equal("", Faker::Address.city_suffix)
|
35
|
+
end
|
36
|
+
|
37
|
+
def test_uk_states_do_not_have_abbreviations
|
38
|
+
assert_equal("", Faker::Address.state_abbr)
|
39
|
+
end
|
40
|
+
|
41
|
+
def test_uk_company_prefix_returns_true_value
|
42
|
+
assert_send([Faker::Company, :prefix])
|
43
|
+
end
|
44
|
+
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.
|
4
|
+
version: 1.5.0
|
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: 2015-08-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: i18n
|
@@ -42,8 +42,10 @@ files:
|
|
42
42
|
- lib/faker/app.rb
|
43
43
|
- lib/faker/avatar.rb
|
44
44
|
- lib/faker/bitcoin.rb
|
45
|
+
- lib/faker/book.rb
|
45
46
|
- lib/faker/business.rb
|
46
47
|
- lib/faker/code.rb
|
48
|
+
- lib/faker/color.rb
|
47
49
|
- lib/faker/commerce.rb
|
48
50
|
- lib/faker/company.rb
|
49
51
|
- lib/faker/date.rb
|
@@ -54,9 +56,12 @@ files:
|
|
54
56
|
- lib/faker/name.rb
|
55
57
|
- lib/faker/number.rb
|
56
58
|
- lib/faker/phone_number.rb
|
59
|
+
- lib/faker/slack_emoji.rb
|
57
60
|
- lib/faker/team.rb
|
58
61
|
- lib/faker/time.rb
|
62
|
+
- lib/faker/university.rb
|
59
63
|
- lib/faker/version.rb
|
64
|
+
- lib/helpers/char.rb
|
60
65
|
- lib/locales/de-AT.yml
|
61
66
|
- lib/locales/de-CH.yml
|
62
67
|
- lib/locales/de.yml
|
@@ -66,6 +71,7 @@ files:
|
|
66
71
|
- lib/locales/en-GB.yml
|
67
72
|
- lib/locales/en-IND.yml
|
68
73
|
- lib/locales/en-NEP.yml
|
74
|
+
- lib/locales/en-UG.yml
|
69
75
|
- lib/locales/en-US.yml
|
70
76
|
- lib/locales/en-au-ocker.yml
|
71
77
|
- lib/locales/en.yml
|
@@ -82,20 +88,26 @@ files:
|
|
82
88
|
- lib/locales/ru.yml
|
83
89
|
- lib/locales/sk.yml
|
84
90
|
- lib/locales/sv.yml
|
91
|
+
- lib/locales/uk.yml
|
85
92
|
- lib/locales/vi.yml
|
86
93
|
- lib/locales/zh-CN.yml
|
94
|
+
- lib/locales/zh-TW.yml
|
87
95
|
- test/test_array_sample_method_compat.rb
|
88
96
|
- test/test_avatar.rb
|
89
97
|
- test/test_en_au_ocker_locale.rb
|
98
|
+
- test/test_en_ca_locale.rb
|
90
99
|
- test/test_en_locale.rb
|
100
|
+
- test/test_en_ug_locale.rb
|
91
101
|
- test/test_en_us_locale.rb
|
92
102
|
- test/test_es_locale.rb
|
93
103
|
- test/test_faker.rb
|
94
104
|
- test/test_faker_app.rb
|
95
105
|
- test/test_faker_bitcoin.rb
|
106
|
+
- test/test_faker_book.rb
|
96
107
|
- test/test_faker_business.rb
|
97
108
|
- test/test_faker_city.rb
|
98
109
|
- test/test_faker_code.rb
|
110
|
+
- test/test_faker_color.rb
|
99
111
|
- test/test_faker_commerce.rb
|
100
112
|
- test/test_faker_company.rb
|
101
113
|
- test/test_faker_date.rb
|
@@ -104,13 +116,16 @@ files:
|
|
104
116
|
- test/test_faker_lorem.rb
|
105
117
|
- test/test_faker_name.rb
|
106
118
|
- test/test_faker_number.rb
|
119
|
+
- test/test_faker_slack_emoji.rb
|
107
120
|
- test/test_faker_street.rb
|
108
121
|
- test/test_faker_team.rb
|
109
122
|
- test/test_faker_time.rb
|
123
|
+
- test/test_faker_university.rb
|
110
124
|
- test/test_flexible.rb
|
111
125
|
- test/test_helper.rb
|
112
126
|
- test/test_locale.rb
|
113
127
|
- test/test_pl_locale.rb
|
128
|
+
- test/test_uk_locale.rb
|
114
129
|
homepage: https://github.com/stympy/faker
|
115
130
|
licenses:
|
116
131
|
- MIT
|
@@ -130,8 +145,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
130
145
|
- !ruby/object:Gem::Version
|
131
146
|
version: '0'
|
132
147
|
requirements: []
|
133
|
-
rubyforge_project:
|
134
|
-
rubygems_version: 2.2.
|
148
|
+
rubyforge_project:
|
149
|
+
rubygems_version: 2.2.2
|
135
150
|
signing_key:
|
136
151
|
specification_version: 4
|
137
152
|
summary: Easily generate fake data
|
@@ -139,15 +154,19 @@ test_files:
|
|
139
154
|
- test/test_array_sample_method_compat.rb
|
140
155
|
- test/test_avatar.rb
|
141
156
|
- test/test_en_au_ocker_locale.rb
|
157
|
+
- test/test_en_ca_locale.rb
|
142
158
|
- test/test_en_locale.rb
|
159
|
+
- test/test_en_ug_locale.rb
|
143
160
|
- test/test_en_us_locale.rb
|
144
161
|
- test/test_es_locale.rb
|
145
162
|
- test/test_faker.rb
|
146
163
|
- test/test_faker_app.rb
|
147
164
|
- test/test_faker_bitcoin.rb
|
165
|
+
- test/test_faker_book.rb
|
148
166
|
- test/test_faker_business.rb
|
149
167
|
- test/test_faker_city.rb
|
150
168
|
- test/test_faker_code.rb
|
169
|
+
- test/test_faker_color.rb
|
151
170
|
- test/test_faker_commerce.rb
|
152
171
|
- test/test_faker_company.rb
|
153
172
|
- test/test_faker_date.rb
|
@@ -156,10 +175,13 @@ test_files:
|
|
156
175
|
- test/test_faker_lorem.rb
|
157
176
|
- test/test_faker_name.rb
|
158
177
|
- test/test_faker_number.rb
|
178
|
+
- test/test_faker_slack_emoji.rb
|
159
179
|
- test/test_faker_street.rb
|
160
180
|
- test/test_faker_team.rb
|
161
181
|
- test/test_faker_time.rb
|
182
|
+
- test/test_faker_university.rb
|
162
183
|
- test/test_flexible.rb
|
163
184
|
- test/test_helper.rb
|
164
185
|
- test/test_locale.rb
|
165
186
|
- test/test_pl_locale.rb
|
187
|
+
- test/test_uk_locale.rb
|