factory-helper 1.5.1 → 1.6.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +13 -5
- data/History.txt +3 -3
- data/README.md +159 -153
- data/lib/factory-helper.rb +9 -10
- data/lib/factory-helper/address.rb +1 -1
- data/lib/factory-helper/app.rb +1 -1
- data/lib/factory-helper/avatar.rb +2 -2
- data/lib/factory-helper/bitcoin.rb +1 -1
- data/lib/factory-helper/business.rb +1 -1
- data/lib/factory-helper/code.rb +1 -1
- data/lib/factory-helper/commerce.rb +1 -1
- data/lib/factory-helper/company.rb +3 -3
- data/lib/factory-helper/date.rb +2 -2
- data/lib/factory-helper/finance.rb +1 -1
- data/lib/factory-helper/hacker.rb +1 -1
- data/lib/factory-helper/internet.rb +2 -2
- data/lib/factory-helper/lorem.rb +4 -4
- data/lib/factory-helper/name.rb +1 -1
- data/lib/factory-helper/number.rb +2 -2
- data/lib/factory-helper/phone_number.rb +1 -1
- data/lib/factory-helper/team.rb +2 -2
- data/lib/factory-helper/time.rb +1 -1
- data/lib/factory-helper/version.rb +1 -1
- data/lib/locales/de-AT.yml +1 -1
- data/lib/locales/de-CH.yml +1 -1
- data/lib/locales/de.yml +1 -1
- data/lib/locales/en-AU.yml +1 -1
- data/lib/locales/en-BORK.yml +1 -1
- data/lib/locales/en-CA.yml +2 -2
- data/lib/locales/en-GB.yml +1 -1
- data/lib/locales/en-IND.yml +1 -1
- data/lib/locales/en-NEP.yml +1 -1
- data/lib/locales/en-US.yml +1 -1
- data/lib/locales/en-au-ocker.yml +1 -1
- data/lib/locales/en.yml +1 -1
- data/lib/locales/es.yml +1 -1
- data/lib/locales/fa.yml +1 -1
- data/lib/locales/fr.yml +1 -1
- data/lib/locales/it.yml +1 -1
- data/lib/locales/ja.yml +1 -1
- data/lib/locales/ko.yml +1 -1
- data/lib/locales/nb-NO.yml +1 -1
- data/lib/locales/nl.yml +16 -16
- data/lib/locales/pl.yml +1 -1
- data/lib/locales/pt-BR.yml +1 -1
- data/lib/locales/ru.yml +2 -2
- data/lib/locales/sk.yml +1 -1
- data/lib/locales/sv.yml +1 -1
- data/lib/locales/vi.yml +1 -1
- data/lib/locales/zh-CN.yml +1 -1
- data/lib/locales/zh-TW.yml +1 -1
- metadata +45 -19
- data/lib/extensions/array.rb +0 -22
- data/lib/extensions/symbol.rb +0 -9
checksums.yaml
CHANGED
@@ -1,7 +1,15 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
NzM3MTQ4NDNiYzhiYzBjMTcwNDU0MTQ5YzJiMDAxZjE4YmU5MzE0MA==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
OGRmMTNiNGM3MzkxYzc5MmI0ZDBlOWRhNjI5ZmUyZmI2Njc5Mzk0Ng==
|
5
7
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
ODQ0ZDk5MTNhMmUxNzJhYmNjMDg2MmY0NGNjNDRlNWY2ZmNjMTFiMWJiOTAw
|
10
|
+
YTczODI0MjNmYjY5YjNlN2VkZTNkYWVlNDA0MDE1MWQ1MWM1YzZmNjM3ZTIx
|
11
|
+
MGQyZjBiZjI1NWYzNmEwMzY5ZDlmMDEzMzA5MDhiNmJhOTJjYjA=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
ZmM3YzAzYmI2YzZkMTFjZmNkYTZkNWMzOTkxM2E5MzcxZjFlZWRiOTRmOTBk
|
14
|
+
ZjQ2MzY5YjgyZjNiMWRiOWNmNjNhNjllZTc3NDRlNzA1MDIyYTM4NDU1MjIw
|
15
|
+
ZTg4NjBkMzVhOWZmMDgyZDhkNjJmNDBkMWIzYjZlZmE4Y2RkYWY=
|
data/History.txt
CHANGED
@@ -33,7 +33,7 @@
|
|
33
33
|
* 1 major change:
|
34
34
|
* Removed deprecated methods from Address: earth_country, us_state, us_state_abbr, uk_postcode, uk_county
|
35
35
|
* Many minor changes (please see github pull requests for credits)
|
36
|
-
* Added many localizations
|
36
|
+
* Added many localizations
|
37
37
|
* Added range and array support for Lorem
|
38
38
|
|
39
39
|
== 1.0.1 2011-09-27
|
@@ -67,7 +67,7 @@
|
|
67
67
|
* Added Canadian translation [igbanam]
|
68
68
|
* Added Norwegian translation [kytrinyx]
|
69
69
|
* Lots of translation-related cleanup [kytrinyx]
|
70
|
-
|
70
|
+
|
71
71
|
|
72
72
|
== 0.9.5 2011-01-27
|
73
73
|
* 1 minor bug fix:
|
@@ -109,7 +109,7 @@
|
|
109
109
|
* 3 major enhancements:
|
110
110
|
* Added Lorem to generate fake Latin
|
111
111
|
* Added secondary_address to Address, and made inclusion of
|
112
|
-
secondary address in street_address optional (false by
|
112
|
+
secondary address in street_address optional (false by
|
113
113
|
default).
|
114
114
|
* Added UK address methods [Caius Durling]
|
115
115
|
|
data/README.md
CHANGED
@@ -2,9 +2,15 @@ factory-helper
|
|
2
2
|
=====
|
3
3
|
This gem began life as a fork of [stympy's Faker](https://github.com/stympy/faker).
|
4
4
|
|
5
|
+
**This is currently considered a _pre-release_ version by the authors.**
|
6
|
+
|
5
7
|
Its purpose is to facilitate software testing by allowing factories to have a solid source of random data with defined characteristics, but can be used for many other purposes as well as in production code.
|
6
8
|
|
7
|
-
It's main use-case is slightly different than
|
9
|
+
It's main use-case is slightly different than Faker and will evolve in that direction, with a primary focus on software testing and not real-looking data. Also the plan is to get some new features added, some of which have been stuck in PRs on the original repo, and many are planned by the authors.
|
10
|
+
|
11
|
+
[![Build Status](https://travis-ci.org/factory-helper/factory-helper.svg)](https://travis-ci.org/factory-helper/factory-helper)
|
12
|
+
[![Coverage Status](https://coveralls.io/repos/factory-helper/factory-helper/badge.svg)](https://coveralls.io/r/factory-helper/factory-helper)
|
13
|
+
[![Gem Version](https://badge.fury.io/rb/factory-helper.svg)](http://badge.fury.io/rb/factory-helper)
|
8
14
|
|
9
15
|
Installing
|
10
16
|
----------
|
@@ -15,294 +21,294 @@ gem install factory-helper
|
|
15
21
|
##Usage
|
16
22
|
-----
|
17
23
|
```ruby
|
18
|
-
|
24
|
+
FactoryHelper::Name.name #=> "Christophe Bartell"
|
19
25
|
|
20
|
-
|
26
|
+
FactoryHelper::Internet.email #=> "kirsten.greenholt@corkeryfisher.info"
|
21
27
|
```
|
22
28
|
|
23
|
-
###
|
29
|
+
###FactoryHelper::Address
|
24
30
|
-----------------
|
25
31
|
|
26
32
|
```ruby
|
27
|
-
|
33
|
+
FactoryHelper::Address.city #=> "Imogeneborough"
|
28
34
|
|
29
|
-
|
35
|
+
FactoryHelper::Address.street_name #=> "Larkin Fork"
|
30
36
|
|
31
|
-
|
37
|
+
FactoryHelper::Address.street_address #=> "282 Kevin Brook"
|
32
38
|
|
33
|
-
|
39
|
+
FactoryHelper::Address.secondary_address #=> "Apt. 672"
|
34
40
|
|
35
|
-
|
41
|
+
FactoryHelper::Address.building_number #=> "7304"
|
36
42
|
|
37
|
-
|
43
|
+
FactoryHelper::Address.zip_code #=> "58517"
|
38
44
|
|
39
|
-
|
45
|
+
FactoryHelper::Address.zip #=> "58517"
|
40
46
|
|
41
|
-
|
47
|
+
FactoryHelper::Address.postcode #=> "58517"
|
42
48
|
|
43
|
-
|
49
|
+
FactoryHelper::Address.time_zone #=> "Asia/Yakutsk"
|
44
50
|
|
45
|
-
|
51
|
+
FactoryHelper::Address.street_suffix #=> "Street"
|
46
52
|
|
47
|
-
|
53
|
+
FactoryHelper::Address.city_suffix #=> "fort"
|
48
54
|
|
49
|
-
|
55
|
+
FactoryHelper::Address.city_prefix #=> "Lake"
|
50
56
|
|
51
|
-
|
57
|
+
FactoryHelper::Address.state_abbr #=> "AP"
|
52
58
|
|
53
|
-
|
59
|
+
FactoryHelper::Address.state #=> "California"
|
54
60
|
|
55
|
-
|
61
|
+
FactoryHelper::Address.country #=> "French Guiana"
|
56
62
|
|
57
|
-
|
63
|
+
FactoryHelper::Address.latitude #=> "-58.17256227443719"
|
58
64
|
|
59
|
-
|
65
|
+
FactoryHelper::Address.longitude #=> "-156.65548382095133"
|
60
66
|
|
61
67
|
|
62
68
|
```
|
63
69
|
|
64
|
-
###
|
70
|
+
###FactoryHelper::Bitcoin
|
65
71
|
-----------------
|
66
72
|
|
67
73
|
```ruby
|
68
74
|
|
69
|
-
|
70
|
-
|
75
|
+
FactoryHelper::Bitcoin.address #=> "1HUoGjmgChmnxxYhz87YytV4gVjfPaExmh"
|
76
|
+
FactoryHelper::Bitcoin.testnet_address #=> ""msHGunDvoEwmVFXvd2Bub1SNw5RP1YHJaf""
|
71
77
|
|
72
78
|
```
|
73
79
|
|
74
|
-
###
|
80
|
+
###FactoryHelper::Business
|
75
81
|
------------------
|
76
82
|
|
77
83
|
```ruby
|
78
84
|
|
79
|
-
|
85
|
+
FactoryHelper::Business.credit_card_number #=> "1228-1221-1221-1431"
|
80
86
|
|
81
|
-
|
87
|
+
FactoryHelper::Business.credit_card_expiry_date #=> <Date: 2015-11-11 ((2457338j,0s,0n),+0s,2299161j)>
|
82
88
|
|
83
|
-
|
89
|
+
FactoryHelper::Business.credit_card_type #=> "visa"
|
84
90
|
|
85
91
|
```
|
86
92
|
|
87
|
-
###
|
93
|
+
###FactoryHelper::Code
|
88
94
|
--------------
|
89
95
|
|
90
96
|
```ruby
|
91
97
|
|
92
|
-
|
98
|
+
FactoryHelper::Code.isbn #=> "759021701-8"
|
93
99
|
|
94
|
-
|
100
|
+
FactoryHelper::Code.ean #=> "4600051000057"
|
95
101
|
|
96
102
|
```
|
97
103
|
|
98
|
-
###
|
104
|
+
###FactoryHelper::Commerce
|
99
105
|
------------------
|
100
106
|
|
101
107
|
```ruby
|
102
108
|
|
103
|
-
|
109
|
+
FactoryHelper::Commerce.color #=> "lavender"
|
104
110
|
|
105
111
|
# Optional arguments max=3, fixed_amount=false
|
106
|
-
|
107
|
-
|
108
|
-
|
112
|
+
FactoryHelper::Commerce.department #=> "Grocery, Health & Beauty"
|
113
|
+
FactoryHelper::Commerce.department(5) #=> "Grocery, Books, Health & Beauty"
|
114
|
+
FactoryHelper::Commerce.department(2, true) #=> "Books & Tools"
|
109
115
|
|
110
|
-
|
116
|
+
FactoryHelper::Commerce.product_name #=> "Practical Granite Shirt"
|
111
117
|
|
112
|
-
|
118
|
+
FactoryHelper::Commerce.price #=> "44.6"
|
113
119
|
|
114
120
|
```
|
115
121
|
|
116
|
-
###
|
122
|
+
###FactoryHelper::Company
|
117
123
|
-----------------
|
118
124
|
|
119
125
|
```ruby
|
120
126
|
|
121
|
-
|
127
|
+
FactoryHelper::Company.name #=> "Hirthe-Ritchie"
|
122
128
|
|
123
|
-
|
129
|
+
FactoryHelper::Company.suffix #=> "Group"
|
124
130
|
|
125
131
|
# Generate a buzzword-laden catch phrase.
|
126
|
-
|
132
|
+
FactoryHelper::Company.catch_phrase #=> "Business-focused coherent parallelism"
|
127
133
|
|
128
134
|
# When a straight answer won't do, BS to the rescue!
|
129
|
-
|
135
|
+
FactoryHelper::Company.bs #=> "empower one-to-one web-readiness"
|
130
136
|
|
131
|
-
|
137
|
+
FactoryHelper::Company.ein #=> "34-8488813"
|
132
138
|
|
133
|
-
|
139
|
+
FactoryHelper::Company.duns_number #=> "08-341-3736"
|
134
140
|
|
135
141
|
# Get a random company logo url in PNG format.
|
136
|
-
|
142
|
+
FactoryHelper::Company.logo #=> "http://pigment.github.com/fake-logos/logos/medium/color/5.png"
|
137
143
|
|
138
144
|
```
|
139
145
|
|
140
|
-
###
|
146
|
+
###FactoryHelper::Date
|
141
147
|
---------------------
|
142
148
|
|
143
149
|
```ruby
|
144
150
|
# Random date between dates
|
145
|
-
|
151
|
+
FactoryHelper::Date.between(2.days.ago, Date.today) #=> "Wed, 24 Sep 2014"
|
146
152
|
|
147
153
|
# Random date in the future (up to maximum of N days)
|
148
|
-
|
154
|
+
FactoryHelper::Date.forward(23) # => "Fri, 03 Oct 2014"
|
149
155
|
|
150
156
|
# Random date in the past (up to maximum of N days)
|
151
|
-
|
157
|
+
FactoryHelper::Date.backward(14) #=> "Fri, 19 Sep 2014"
|
152
158
|
```
|
153
159
|
|
154
|
-
###
|
160
|
+
###FactoryHelper::Internet
|
155
161
|
---------------
|
156
162
|
|
157
163
|
```ruby
|
158
164
|
# Optional argument name=nil
|
159
|
-
|
165
|
+
FactoryHelper::Internet.email #=> "eliza@mann.net"
|
160
166
|
|
161
|
-
|
167
|
+
FactoryHelper::Internet.email('Nancy') #=> "nancy@terry.biz"
|
162
168
|
|
163
169
|
# Optional argument name=nil
|
164
|
-
|
170
|
+
FactoryHelper::Internet.free_email #=> "freddy@gmail.com"
|
165
171
|
|
166
|
-
|
172
|
+
FactoryHelper::Internet.free_email('Nancy') #=> "nancy@yahoo.com"
|
167
173
|
|
168
174
|
# Optional argument name=nil
|
169
|
-
|
175
|
+
FactoryHelper::Internet.safe_email #=> "christelle@example.org"
|
170
176
|
|
171
|
-
|
177
|
+
FactoryHelper::Internet.safe_email('Nancy') #=> "nancy@example.net"
|
172
178
|
|
173
179
|
# Optional arguments specifier=nil, separators=%w(. _)
|
174
|
-
|
180
|
+
FactoryHelper::Internet.user_name #=> "alexie"
|
175
181
|
|
176
|
-
|
182
|
+
FactoryHelper::Internet.user_name('Nancy') #=> "nancy"
|
177
183
|
|
178
|
-
|
184
|
+
FactoryHelper::Internet.user_name('Nancy Johnson', %w(. _ -)) #=> "johnson-nancy"
|
179
185
|
|
180
186
|
# Optional arguments: min_length=8, max_length=16
|
181
|
-
|
187
|
+
FactoryHelper::Internet.password #=> "vg5msvy1uerg7"
|
182
188
|
|
183
|
-
|
189
|
+
FactoryHelper::Internet.password(8) #=> "yfgjik0hgzdqs0"
|
184
190
|
|
185
|
-
|
191
|
+
FactoryHelper::Internet.password(10, 20) #=> "eoc9shwd1hwq4vbgfw"
|
186
192
|
|
187
|
-
|
193
|
+
FactoryHelper::Internet.domain_name #=> "effertz.info"
|
188
194
|
|
189
|
-
|
195
|
+
FactoryHelper::Internet.fix_umlauts('äöüß') #=> "aeoeuess"
|
190
196
|
|
191
|
-
|
197
|
+
FactoryHelper::Internet.domain_word #=> "haleyziemann"
|
192
198
|
|
193
|
-
|
199
|
+
FactoryHelper::Internet.domain_suffix #=> "info"
|
194
200
|
|
195
|
-
|
201
|
+
FactoryHelper::Internet.ip_v4_address #=> "24.29.18.175"
|
196
202
|
|
197
|
-
|
203
|
+
FactoryHelper::Internet.ip_v6_address #=> "ac5f:d696:3807:1d72:2eb5:4e81:7d2b:e1df"
|
198
204
|
|
199
205
|
# Optional argument prefix=''
|
200
|
-
|
201
|
-
|
206
|
+
FactoryHelper::Internet.mac_address #=> "e6:0d:00:11:ed:4f"
|
207
|
+
FactoryHelper::Internet.mac_address('55:44:33') #=> "55:44:33:02:1d:9b"
|
202
208
|
|
203
209
|
# Optional arguments: host=domain_name, path="/#{user_name}"
|
204
|
-
|
205
|
-
|
206
|
-
|
210
|
+
FactoryHelper::Internet.url #=> "http://thiel.com/chauncey_simonis"
|
211
|
+
FactoryHelper::Internet.url('example.com') #=> "http://example.com/clotilde.swift"
|
212
|
+
FactoryHelper::Internet.url('example.com', '/foobar.html') #=> "http://example.com/foobar.html"
|
207
213
|
|
208
214
|
# Optional arguments: words=nil, glue=nil
|
209
|
-
|
210
|
-
|
211
|
-
|
215
|
+
FactoryHelper::Internet.slug #=> "pariatur_laudantium"
|
216
|
+
FactoryHelper::Internet.slug('foo bar') #=> "foo.bar"
|
217
|
+
FactoryHelper::Internet.slug('foo bar', '-') #=> "foo-bar"
|
212
218
|
|
213
219
|
|
214
220
|
```
|
215
221
|
|
216
|
-
###
|
222
|
+
###FactoryHelper::Lorem
|
217
223
|
---------------
|
218
224
|
|
219
225
|
```ruby
|
220
226
|
|
221
|
-
|
227
|
+
FactoryHelper::Lorem.word #=> "repellendus"
|
222
228
|
|
223
229
|
# Optional arguments: num=3, supplemental=false
|
224
|
-
|
225
|
-
|
226
|
-
|
230
|
+
FactoryHelper::Lorem.words #=> ["dolores", "adipisci", "nesciunt"]
|
231
|
+
FactoryHelper::Lorem.words(4) #=> ["culpa", "recusandae", "aut", "omnis"]
|
232
|
+
FactoryHelper::Lorem.words(4, true) #=> ["colloco", "qui", "vergo", "deporto"]
|
227
233
|
|
228
234
|
# Optional arguments: char_count=255
|
229
|
-
|
230
|
-
|
235
|
+
FactoryHelper::Lorem.characters #=> "uw1ep04lhs0c4d931n1jmrspprf5wrj85fefue0y7y6m56b6omquh7br7dhqijwlawejpl765nb1716idmp3xnfo85v349pzy2o9rir23y2qhflwr71c1585fnynguiphkjm8p0vktwitcsm16lny7jzp9t4drwav3qmhz4yjq4k04x14gl6p148hulyqioo72tf8nwrxxcclfypz2lc58lsibgfe5w5p0xv95peafjjmm2frkhdc6duoky0aha"
|
236
|
+
FactoryHelper::Lorem.characters(10) #=> "ang9cbhoa8"
|
231
237
|
|
232
238
|
# Optional arguments: word_count=4, supplemental=false, random_words_to_add=6
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
239
|
+
FactoryHelper::Lorem.sentence #=> "Dolore illum animi et neque accusantium."
|
240
|
+
FactoryHelper::Lorem.sentence(3) #=> "Commodi qui minus deserunt sed vero quia."
|
241
|
+
FactoryHelper::Lorem.sentence(3, true) #=> "Inflammatio denego necessitatibus caelestis autus illum."
|
242
|
+
FactoryHelper::Lorem.sentence(3, false, 4) #=> "Aut voluptatem illum fugit ut sit."
|
243
|
+
FactoryHelper::Lorem.sentence(3, true, 4) #=> "Accusantium tantillus dolorem timor."
|
238
244
|
|
239
245
|
# Optional arguments: sentence_count=3, supplemental=false
|
240
|
-
|
241
|
-
|
242
|
-
|
246
|
+
FactoryHelper::Lorem.sentences #=> ["Vero earum commodi soluta.", "Quaerat fuga cumque et vero eveniet omnis ut.", "Cumque sit dolor ut est consequuntur."]
|
247
|
+
FactoryHelper::Lorem.sentences(1) #=> ["Ut perspiciatis explicabo possimus doloribus enim quia."]
|
248
|
+
FactoryHelper::Lorem.sentences(1, true) #=> ["Quis capillus curo ager veritatis voro et ipsum."]
|
243
249
|
|
244
250
|
# Optional arguments: sentence_count=3, supplemental=false, random_sentences_to_add=3
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
251
|
+
FactoryHelper::Lorem.paragraph #=> "Neque dicta enim quasi. Qui corrupti est quisquam. Facere animi quod aut. Qui nulla consequuntur consectetur sapiente."
|
252
|
+
FactoryHelper::Lorem.paragraph(2) #=> "Illo qui voluptas. Id sit quaerat enim aut cupiditate voluptates dolorum. Porro necessitatibus numquam dolor quia earum."
|
253
|
+
FactoryHelper::Lorem.paragraph(2, true) #=> ""
|
254
|
+
FactoryHelper::Lorem.paragraph(2, false, 4) #=> ""
|
255
|
+
FactoryHelper::Lorem.paragraph(2, true, 4) #=> ""
|
250
256
|
|
251
257
|
# Optional arguments: paragraph_count=3, supplemental=false
|
252
|
-
|
253
|
-
|
254
|
-
|
258
|
+
FactoryHelper::Lorem.paragraphs #=> ""
|
259
|
+
FactoryHelper::Lorem.paragraphs(1) #=> ""
|
260
|
+
FactoryHelper::Lorem.paragraphs(1, true) #=> ""
|
255
261
|
|
256
262
|
```
|
257
263
|
|
258
|
-
###
|
264
|
+
###FactoryHelper::Name
|
259
265
|
--------------
|
260
266
|
|
261
267
|
```ruby
|
262
268
|
|
263
|
-
|
269
|
+
FactoryHelper::Name.name #=> "Tyshawn Johns Sr."
|
264
270
|
|
265
|
-
|
271
|
+
FactoryHelper::Name.first_name #=> "Kaci"
|
266
272
|
|
267
|
-
|
273
|
+
FactoryHelper::Name.last_name #=> "Ernser"
|
268
274
|
|
269
|
-
|
275
|
+
FactoryHelper::Name.prefix #=> "Mr."
|
270
276
|
|
271
|
-
|
277
|
+
FactoryHelper::Name.suffix #=> "IV"
|
272
278
|
|
273
|
-
|
279
|
+
FactoryHelper::Name.title #=> "Legacy Creative Director"
|
274
280
|
|
275
281
|
```
|
276
282
|
|
277
|
-
###
|
283
|
+
###FactoryHelper::Avatar
|
278
284
|
----------------
|
279
285
|
|
280
286
|
```ruby
|
281
287
|
|
282
|
-
|
288
|
+
FactoryHelper::Avatar.image #=> "http://robohash.org/sitsequiquia.png?size=300x300"
|
283
289
|
|
284
|
-
|
290
|
+
FactoryHelper::Avatar.image("my-own-slug") #=> "http://robohash.org/my-own-slug.png?size=300x300"
|
285
291
|
|
286
|
-
|
292
|
+
FactoryHelper::Avatar.image("my-own-slug", "50x50") #=> "http://robohash.org/my-own-slug.png?size=50x50"
|
287
293
|
|
288
|
-
|
294
|
+
FactoryHelper::Avatar.image("my-own-slug", "50x50", "jpg") #=> "http://robohash.org/my-own-slug.jpg?size=50x50"
|
289
295
|
|
290
|
-
|
296
|
+
FactoryHelper::Avatar.image("my-own-slug", "50x50", "bmp") #=> "http://robohash.org/my-own-slug.bmp?size=50x50"
|
291
297
|
```
|
292
298
|
|
293
|
-
###
|
299
|
+
###FactoryHelper::Number
|
294
300
|
----------------
|
295
301
|
|
296
302
|
```ruby
|
297
303
|
|
298
304
|
# Required parameter: digits
|
299
|
-
|
305
|
+
FactoryHelper::Number.number(10) #=> "1968353479"
|
300
306
|
|
301
|
-
|
307
|
+
FactoryHelper::Number.digit #=> "1"
|
302
308
|
|
303
309
|
```
|
304
310
|
|
305
|
-
###
|
311
|
+
###FactoryHelper::PhoneNumber
|
306
312
|
---------------------
|
307
313
|
|
308
314
|
Phone numbers may be in any of the following formats:
|
@@ -321,87 +327,87 @@ Phone numbers may be in any of the following formats:
|
|
321
327
|
|
322
328
|
```ruby
|
323
329
|
|
324
|
-
|
330
|
+
FactoryHelper::PhoneNumber.phone_number #=> "397.693.1309"
|
325
331
|
|
326
|
-
|
332
|
+
FactoryHelper::PhoneNumber.cell_phone #=> "(186)285-7925"
|
327
333
|
|
328
334
|
# NOTE NOTE NOTE NOTE
|
329
335
|
# For the 'US only' methods below, first you must do the following:
|
330
|
-
|
336
|
+
FactoryHelper::Config.locale = 'en-US'
|
331
337
|
|
332
338
|
# US only
|
333
|
-
|
339
|
+
FactoryHelper::PhoneNumber.area_code #=> "201"
|
334
340
|
|
335
341
|
# US only
|
336
|
-
|
342
|
+
FactoryHelper::PhoneNumber.exchange_code #=> "208"
|
337
343
|
|
338
344
|
# Optional parameter: length=4
|
339
|
-
|
345
|
+
FactoryHelper::PhoneNumber.subscriber_number #=> "3873"
|
340
346
|
|
341
|
-
|
347
|
+
FactoryHelper::PhoneNumber.subscriber_number(2) #=> "39"
|
342
348
|
|
343
|
-
|
349
|
+
FactoryHelper::PhoneNumber.extension #=> "3764"
|
344
350
|
|
345
351
|
```
|
346
352
|
|
347
|
-
###
|
353
|
+
###FactoryHelper::Time
|
348
354
|
---------------------
|
349
355
|
|
350
356
|
```ruby
|
351
357
|
# Random date between dates
|
352
|
-
|
358
|
+
FactoryHelper::Time.between(2.days.ago, Time.now) #=> "2014-09-18 12:30:59 -0700"
|
353
359
|
|
354
360
|
# Random date between dates (within specified part of the day)
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
361
|
+
FactoryHelper::Time.between(2.days.ago, Time.now, :all) #=> "2014-09-19 07:03:30 -0700"
|
362
|
+
FactoryHelper::Time.between(2.days.ago, Time.now, :day) #=> "2014-09-18 16:28:13 -0700"
|
363
|
+
FactoryHelper::Time.between(2.days.ago, Time.now, :night) #=> "2014-09-20 19:39:38 -0700"
|
364
|
+
FactoryHelper::Time.between(2.days.ago, Time.now, :morning) #=> "2014-09-19 08:07:52 -0700"
|
365
|
+
FactoryHelper::Time.between(2.days.ago, Time.now, :afternoon) #=> "2014-09-18 12:10:34 -0700"
|
366
|
+
FactoryHelper::Time.between(2.days.ago, Time.now, :evening) #=> "2014-09-19 20:21:03 -0700"
|
367
|
+
FactoryHelper::Time.between(2.days.ago, Time.now, :midnight) #=> "2014-09-20 00:40:14 -0700"
|
362
368
|
|
363
369
|
# Random time in the future (up to maximum of N days)
|
364
|
-
|
370
|
+
FactoryHelper::Time.forward(23, :morning) # => "2014-09-26 06:54:47 -0700"
|
365
371
|
|
366
372
|
# Random time in the past (up to maximum of N days)
|
367
|
-
|
373
|
+
FactoryHelper::Time.backward(14, :evening) #=> "2014-09-17 19:56:33 -0700"
|
368
374
|
```
|
369
375
|
|
370
|
-
###
|
376
|
+
###FactoryHelper::Hacker
|
371
377
|
---------------------
|
372
378
|
Are you having trouble writing tech-savvy dialogue for your latest screenplay?
|
373
379
|
Worry not! Hollywood-grade technical talk is ready to fill out any form where you need to look smart.
|
374
380
|
|
375
381
|
```ruby
|
376
382
|
# Full Phrase
|
377
|
-
|
383
|
+
FactoryHelper::Hacker.say_something_smart #=> "Try to compress the SQL interface, maybe it will program the back-end hard drive!"
|
378
384
|
|
379
385
|
# Short technical abbreviations
|
380
|
-
|
386
|
+
FactoryHelper::Hacker.abbreviation #=> "RAM"
|
381
387
|
|
382
388
|
# Hacker centric adjectives
|
383
|
-
|
389
|
+
FactoryHelper::Hacker.adjective #=> "open-source"
|
384
390
|
|
385
391
|
# Only the best hacker related nouns
|
386
|
-
|
392
|
+
FactoryHelper::Hacker.noun #=> "bandwidth"
|
387
393
|
|
388
394
|
# Actions that hackers take
|
389
|
-
|
395
|
+
FactoryHelper::Hacker.verb #=> "bypass"
|
390
396
|
|
391
397
|
# Verbs that end in -ing
|
392
|
-
|
398
|
+
FactoryHelper::Hacker.ingverb #=> "synthesizing"
|
393
399
|
```
|
394
400
|
|
395
|
-
###
|
401
|
+
###FactoryHelper::App
|
396
402
|
-----------------
|
397
403
|
|
398
404
|
```ruby
|
399
405
|
|
400
|
-
|
406
|
+
FactoryHelper::App.name #=> "Treeflex"
|
401
407
|
|
402
|
-
|
408
|
+
FactoryHelper::App.version #=> "0.7.9"
|
403
409
|
|
404
|
-
|
410
|
+
FactoryHelper::App.author #=> "Daphne Swift"
|
405
411
|
|
406
412
|
```
|
407
413
|
|
@@ -409,10 +415,10 @@ Customization
|
|
409
415
|
------------
|
410
416
|
Since you may want to make addresses and other types of data look different
|
411
417
|
depending on where in the world you are (US postal codes vs. UK postal codes,
|
412
|
-
for example),
|
418
|
+
for example), FactoryHelper uses the I18n gem to store strings (like state names) and
|
413
419
|
formats (US postal codes are NNNNN while UK postal codes are AAN NAA),
|
414
420
|
allowing you to get different formats by switching locales. Just set
|
415
|
-
|
421
|
+
FactoryHelper::Config.locale to the locale you want, and FactoryHelper will take care of the
|
416
422
|
rest.
|
417
423
|
|
418
424
|
If your locale doesn't already exist, create it in the \lib\locales\ directory
|
@@ -421,12 +427,12 @@ and you can then override or add elements to suit
|
|
421
427
|
```yaml
|
422
428
|
|
423
429
|
en-au-ocker:
|
424
|
-
|
430
|
+
factory_helper:
|
425
431
|
name:
|
426
|
-
# Exiting
|
432
|
+
# Exiting factory_helper field, new data
|
427
433
|
first_name: [Charlotte, Ava, Chloe, Emily]
|
428
434
|
|
429
|
-
# New
|
435
|
+
# New factory_helper fields
|
430
436
|
ocker_first_name: [Bazza, Bluey, Davo, Johno, Shano, Shazza]
|
431
437
|
region: [South East Queensland, Wide Bay Burnett, Margaret River, Port Pirie, Gippsland, Elizabeth, Barossa]
|
432
438
|
|
@@ -438,7 +444,7 @@ See [CONTRIBUTING.md](https://github.com/factory-helper/factory-helper/blob/mast
|
|
438
444
|
|
439
445
|
Contact
|
440
446
|
-------
|
441
|
-
Comments and feedback are welcome. Send an email to
|
447
|
+
Comments and feedback are welcome. Send an email to factory-helper@googlegroups.com.
|
442
448
|
|
443
449
|
License
|
444
450
|
-------
|