factory-helper 1.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/History.txt +126 -0
- data/License.txt +20 -0
- data/README.md +445 -0
- data/lib/extensions/array.rb +22 -0
- data/lib/extensions/symbol.rb +9 -0
- data/lib/factory-helper.rb +182 -0
- data/lib/factory-helper/address.rb +59 -0
- data/lib/factory-helper/app.rb +22 -0
- data/lib/factory-helper/avatar.rb +14 -0
- data/lib/factory-helper/bitcoin.rb +49 -0
- data/lib/factory-helper/business.rb +22 -0
- data/lib/factory-helper/code.rb +63 -0
- data/lib/factory-helper/commerce.rb +51 -0
- data/lib/factory-helper/company.rb +40 -0
- data/lib/factory-helper/date.rb +42 -0
- data/lib/factory-helper/finance.rb +26 -0
- data/lib/factory-helper/hacker.rb +31 -0
- data/lib/factory-helper/internet.rb +116 -0
- data/lib/factory-helper/lorem.rb +66 -0
- data/lib/factory-helper/name.rb +22 -0
- data/lib/factory-helper/number.rb +57 -0
- data/lib/factory-helper/phone_number.rb +52 -0
- data/lib/factory-helper/team.rb +20 -0
- data/lib/factory-helper/time.rb +48 -0
- data/lib/factory-helper/version.rb +3 -0
- data/lib/locales/de-AT.yml +49 -0
- data/lib/locales/de-CH.yml +19 -0
- data/lib/locales/de.yml +57 -0
- data/lib/locales/en-AU.yml +22 -0
- data/lib/locales/en-BORK.yml +4 -0
- data/lib/locales/en-CA.yml +14 -0
- data/lib/locales/en-GB.yml +13 -0
- data/lib/locales/en-IND.yml +20 -0
- data/lib/locales/en-NEP.yml +39 -0
- data/lib/locales/en-US.yml +83 -0
- data/lib/locales/en-au-ocker.yml +31 -0
- data/lib/locales/en.yml +155 -0
- data/lib/locales/es.yml +62 -0
- data/lib/locales/fa.yml +6 -0
- data/lib/locales/fr.yml +55 -0
- data/lib/locales/it.yml +59 -0
- data/lib/locales/ja.yml +25 -0
- data/lib/locales/ko.yml +37 -0
- data/lib/locales/nb-NO.yml +52 -0
- data/lib/locales/nl.yml +77 -0
- data/lib/locales/pl.yml +66 -0
- data/lib/locales/pt-BR.yml +57 -0
- data/lib/locales/ru.yml +65 -0
- data/lib/locales/sk.yml +72 -0
- data/lib/locales/sv.yml +76 -0
- data/lib/locales/vi.yml +63 -0
- data/lib/locales/zh-CN.yml +27 -0
- data/lib/locales/zh-TW.yml +27 -0
- metadata +140 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: e0fdfbacd38a4c29692db7f84274ebb71c7252b3
|
4
|
+
data.tar.gz: fef7644c7cf634db2208168b436c520967f55ed7
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 8ef057f0c1e7c45ec6387b65ff217397ac4440620d73eb23bab0e000e5de30b1ee6354d1beb0c51149a66940715d2c1d0bdcde4b837319d2c31be99c6130e1c3
|
7
|
+
data.tar.gz: 0bcb7c625d973de5b149737507864f33d3dbcd5f270d08190403e0f53c1db6d6aef032281698892e9c0d96998bd1df0023b60df7892b993610ddaeecb5b5a0e7
|
data/History.txt
ADDED
@@ -0,0 +1,126 @@
|
|
1
|
+
== 1.4.3 2014-08-15
|
2
|
+
* Updated Russian locale
|
3
|
+
* Added EIN generator
|
4
|
+
* Fixed Swedish locale
|
5
|
+
* Added birthday to Faker::Date
|
6
|
+
* Added Faker::App
|
7
|
+
|
8
|
+
== 1.4.2 2014-07-15
|
9
|
+
* Added Swedish locale
|
10
|
+
* README update
|
11
|
+
|
12
|
+
== 1.4.1 2014-07-04
|
13
|
+
* Bugfix and cleanup
|
14
|
+
|
15
|
+
== 1.4.0 2014-07-03
|
16
|
+
* Many enhancements and bugfixes
|
17
|
+
|
18
|
+
== 1.3.0 2014-03-08
|
19
|
+
* Many enhancements and few bugfixes
|
20
|
+
|
21
|
+
== 1.2.0 2013-07-27
|
22
|
+
* Many major and minor enhancements :)
|
23
|
+
|
24
|
+
== 1.1.2 2012-09-18
|
25
|
+
* 1 minor change:
|
26
|
+
* Fixed Ruby 1.8 compatibility
|
27
|
+
|
28
|
+
== 1.1.1 2012-09-17
|
29
|
+
* 1 minor change:
|
30
|
+
* Removed ja locale because of parse errors
|
31
|
+
|
32
|
+
== 1.1.0 2012-09-15
|
33
|
+
* 1 major change:
|
34
|
+
* Removed deprecated methods from Address: earth_country, us_state, us_state_abbr, uk_postcode, uk_county
|
35
|
+
* Many minor changes (please see github pull requests for credits)
|
36
|
+
* Added many localizations
|
37
|
+
* Added range and array support for Lorem
|
38
|
+
|
39
|
+
== 1.0.1 2011-09-27
|
40
|
+
* 1 minor enhancement
|
41
|
+
* Added safe_email method to get someaddress@example.com [Kazimierz Kiełkowicz]
|
42
|
+
* 1 bug fix:
|
43
|
+
* Use the locale fallback properly when parsing string formats
|
44
|
+
|
45
|
+
== 1.0.0 2011-09-08
|
46
|
+
* 2 major enhancements
|
47
|
+
* Moved all formats to locale files
|
48
|
+
* Stopped interfering with I18n's global settings for fallbacks
|
49
|
+
* 3 minor bug fixes:
|
50
|
+
* Ruby 1.9.2 fixes [eMxyzptlk]
|
51
|
+
* UTF8 fixes [maxmiliano]
|
52
|
+
* Updated IPv4 generator to return valid addresses [Sylvain Desbureaux]
|
53
|
+
* Many minor enhancements:
|
54
|
+
* Added bork locale for bork-ified lorem [johnbentcope]
|
55
|
+
* Added IPv6 address generator [jc00ke]
|
56
|
+
* Removed deprecation warnings for Array#rand [chrismarshall]
|
57
|
+
* Added German translation and I18n improvments [Matthias Kühnert]
|
58
|
+
* Added Dutch translation [moretea]
|
59
|
+
* Added Lat/Long generator [Andy Callaghan]
|
60
|
+
* Added buzzword-laden title generator [supercleanse]
|
61
|
+
* Added optional extended wordlist for lorem [chriskottom]
|
62
|
+
* Updated German translation [Jan Schwenzien]
|
63
|
+
* Locale improvements [suweller]
|
64
|
+
* Added limit to lorem generator [darrenterhune]
|
65
|
+
* Added Brazilian Portuguese translation [maxmiliano]
|
66
|
+
* Added Australian translation [madeindata]
|
67
|
+
* Added Canadian translation [igbanam]
|
68
|
+
* Added Norwegian translation [kytrinyx]
|
69
|
+
* Lots of translation-related cleanup [kytrinyx]
|
70
|
+
|
71
|
+
|
72
|
+
== 0.9.5 2011-01-27
|
73
|
+
* 1 minor bug fix:
|
74
|
+
* Fixed YAML [Aaron Patterson]
|
75
|
+
* 3 minor enhancements:
|
76
|
+
* Added default rake task to run all tests [Aaron Patterson]
|
77
|
+
* Removed shuffle method [Aaron Patterson]
|
78
|
+
* Use psych if present [Aaron Patterson]
|
79
|
+
|
80
|
+
== 0.9.4 2010-12-29
|
81
|
+
* 1 minor bug fix:
|
82
|
+
* Stopped getting in the way of Rails' late locale loading
|
83
|
+
|
84
|
+
== 0.9.3 2010-12-28
|
85
|
+
* 1 minor enhancement:
|
86
|
+
* Added a faker namespace for translations
|
87
|
+
|
88
|
+
== 0.9.2 2010-12-22
|
89
|
+
* 1 bug fix:
|
90
|
+
* Stopped stomping on I18n load path
|
91
|
+
|
92
|
+
== 0.9.1 2010-12-22
|
93
|
+
* 1 bug fix:
|
94
|
+
* Stopped setting I18n default locale
|
95
|
+
* 1 major enhancement:
|
96
|
+
* Added method_missing to Address to add methods based on data in locale files
|
97
|
+
* 1 minor enhancement:
|
98
|
+
* Added Swiss locale [Lukas Westermann]
|
99
|
+
|
100
|
+
== 0.9.0 2010-12-21
|
101
|
+
* 1 major enhancement:
|
102
|
+
* Moved strings and some formats to locale files
|
103
|
+
|
104
|
+
== 0.3.1 2008-04-03
|
105
|
+
* 1 minor enhancement:
|
106
|
+
* Added city to Address
|
107
|
+
|
108
|
+
== 0.3.0 2008-01-01
|
109
|
+
* 3 major enhancements:
|
110
|
+
* Added Lorem to generate fake Latin
|
111
|
+
* Added secondary_address to Address, and made inclusion of
|
112
|
+
secondary address in street_address optional (false by
|
113
|
+
default).
|
114
|
+
* Added UK address methods [Caius Durling]
|
115
|
+
|
116
|
+
== 0.2.1 2007-12-05
|
117
|
+
* 1 major enhancement:
|
118
|
+
* Dropped facets to avoid conflict with ActiveSupport
|
119
|
+
* 2 minor enhancements:
|
120
|
+
* Changed the output of user_name to randomly separate with a . or _
|
121
|
+
* Added a few tests
|
122
|
+
|
123
|
+
== 0.1.0 2007-11-22
|
124
|
+
|
125
|
+
* 1 major enhancement:
|
126
|
+
* Initial release
|
data/License.txt
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2007-2010 Benjamin Curtis
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,445 @@
|
|
1
|
+
factory-helper
|
2
|
+
=====
|
3
|
+
This gem began life as a fork of [stympy's Faker](https://github.com/stympy/faker).
|
4
|
+
|
5
|
+
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
|
+
|
7
|
+
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.
|
8
|
+
|
9
|
+
Installing
|
10
|
+
----------
|
11
|
+
```bash
|
12
|
+
gem install factory-helper
|
13
|
+
```
|
14
|
+
|
15
|
+
##Usage
|
16
|
+
-----
|
17
|
+
```ruby
|
18
|
+
Faker::Name.name #=> "Christophe Bartell"
|
19
|
+
|
20
|
+
Faker::Internet.email #=> "kirsten.greenholt@corkeryfisher.info"
|
21
|
+
```
|
22
|
+
|
23
|
+
###Faker::Address
|
24
|
+
-----------------
|
25
|
+
|
26
|
+
```ruby
|
27
|
+
Faker::Address.city #=> "Imogeneborough"
|
28
|
+
|
29
|
+
Faker::Address.street_name #=> "Larkin Fork"
|
30
|
+
|
31
|
+
Faker::Address.street_address #=> "282 Kevin Brook"
|
32
|
+
|
33
|
+
Faker::Address.secondary_address #=> "Apt. 672"
|
34
|
+
|
35
|
+
Faker::Address.building_number #=> "7304"
|
36
|
+
|
37
|
+
Faker::Address.zip_code #=> "58517"
|
38
|
+
|
39
|
+
Faker::Address.zip #=> "58517"
|
40
|
+
|
41
|
+
Faker::Address.postcode #=> "58517"
|
42
|
+
|
43
|
+
Faker::Address.time_zone #=> "Asia/Yakutsk"
|
44
|
+
|
45
|
+
Faker::Address.street_suffix #=> "Street"
|
46
|
+
|
47
|
+
Faker::Address.city_suffix #=> "fort"
|
48
|
+
|
49
|
+
Faker::Address.city_prefix #=> "Lake"
|
50
|
+
|
51
|
+
Faker::Address.state_abbr #=> "AP"
|
52
|
+
|
53
|
+
Faker::Address.state #=> "California"
|
54
|
+
|
55
|
+
Faker::Address.country #=> "French Guiana"
|
56
|
+
|
57
|
+
Faker::Address.latitude #=> "-58.17256227443719"
|
58
|
+
|
59
|
+
Faker::Address.longitude #=> "-156.65548382095133"
|
60
|
+
|
61
|
+
|
62
|
+
```
|
63
|
+
|
64
|
+
###Faker::Bitcoin
|
65
|
+
-----------------
|
66
|
+
|
67
|
+
```ruby
|
68
|
+
|
69
|
+
Faker::Bitcoin.address #=> "1HUoGjmgChmnxxYhz87YytV4gVjfPaExmh"
|
70
|
+
Faker::Bitcoin.testnet_address #=> ""msHGunDvoEwmVFXvd2Bub1SNw5RP1YHJaf""
|
71
|
+
|
72
|
+
```
|
73
|
+
|
74
|
+
###Faker::Business
|
75
|
+
------------------
|
76
|
+
|
77
|
+
```ruby
|
78
|
+
|
79
|
+
Faker::Business.credit_card_number #=> "1228-1221-1221-1431"
|
80
|
+
|
81
|
+
Faker::Business.credit_card_expiry_date #=> <Date: 2015-11-11 ((2457338j,0s,0n),+0s,2299161j)>
|
82
|
+
|
83
|
+
Faker::Business.credit_card_type #=> "visa"
|
84
|
+
|
85
|
+
```
|
86
|
+
|
87
|
+
###Faker::Code
|
88
|
+
--------------
|
89
|
+
|
90
|
+
```ruby
|
91
|
+
|
92
|
+
Faker::Code.isbn #=> "759021701-8"
|
93
|
+
|
94
|
+
Faker::Code.ean #=> "4600051000057"
|
95
|
+
|
96
|
+
```
|
97
|
+
|
98
|
+
###Faker::Commerce
|
99
|
+
------------------
|
100
|
+
|
101
|
+
```ruby
|
102
|
+
|
103
|
+
Faker::Commerce.color #=> "lavender"
|
104
|
+
|
105
|
+
# Optional arguments max=3, fixed_amount=false
|
106
|
+
Faker::Commerce.department #=> "Grocery, Health & Beauty"
|
107
|
+
Faker::Commerce.department(5) #=> "Grocery, Books, Health & Beauty"
|
108
|
+
Faker::Commerce.department(2, true) #=> "Books & Tools"
|
109
|
+
|
110
|
+
Faker::Commerce.product_name #=> "Practical Granite Shirt"
|
111
|
+
|
112
|
+
Faker::Commerce.price #=> "44.6"
|
113
|
+
|
114
|
+
```
|
115
|
+
|
116
|
+
###Faker::Company
|
117
|
+
-----------------
|
118
|
+
|
119
|
+
```ruby
|
120
|
+
|
121
|
+
Faker::Company.name #=> "Hirthe-Ritchie"
|
122
|
+
|
123
|
+
Faker::Company.suffix #=> "Group"
|
124
|
+
|
125
|
+
# Generate a buzzword-laden catch phrase.
|
126
|
+
Faker::Company.catch_phrase #=> "Business-focused coherent parallelism"
|
127
|
+
|
128
|
+
# When a straight answer won't do, BS to the rescue!
|
129
|
+
Faker::Company.bs #=> "empower one-to-one web-readiness"
|
130
|
+
|
131
|
+
Faker::Company.ein #=> "34-8488813"
|
132
|
+
|
133
|
+
Faker::Company.duns_number #=> "08-341-3736"
|
134
|
+
|
135
|
+
# Get a random company logo url in PNG format.
|
136
|
+
Faker::Company.logo #=> "http://pigment.github.com/fake-logos/logos/medium/color/5.png"
|
137
|
+
|
138
|
+
```
|
139
|
+
|
140
|
+
###Faker::Date
|
141
|
+
---------------------
|
142
|
+
|
143
|
+
```ruby
|
144
|
+
# Random date between dates
|
145
|
+
Faker::Date.between(2.days.ago, Date.today) #=> "Wed, 24 Sep 2014"
|
146
|
+
|
147
|
+
# Random date in the future (up to maximum of N days)
|
148
|
+
Faker::Date.forward(23) # => "Fri, 03 Oct 2014"
|
149
|
+
|
150
|
+
# Random date in the past (up to maximum of N days)
|
151
|
+
Faker::Date.backward(14) #=> "Fri, 19 Sep 2014"
|
152
|
+
```
|
153
|
+
|
154
|
+
###Faker::Internet
|
155
|
+
---------------
|
156
|
+
|
157
|
+
```ruby
|
158
|
+
# Optional argument name=nil
|
159
|
+
Faker::Internet.email #=> "eliza@mann.net"
|
160
|
+
|
161
|
+
Faker::Internet.email('Nancy') #=> "nancy@terry.biz"
|
162
|
+
|
163
|
+
# Optional argument name=nil
|
164
|
+
Faker::Internet.free_email #=> "freddy@gmail.com"
|
165
|
+
|
166
|
+
Faker::Internet.free_email('Nancy') #=> "nancy@yahoo.com"
|
167
|
+
|
168
|
+
# Optional argument name=nil
|
169
|
+
Faker::Internet.safe_email #=> "christelle@example.org"
|
170
|
+
|
171
|
+
Faker::Internet.safe_email('Nancy') #=> "nancy@example.net"
|
172
|
+
|
173
|
+
# Optional arguments specifier=nil, separators=%w(. _)
|
174
|
+
Faker::Internet.user_name #=> "alexie"
|
175
|
+
|
176
|
+
Faker::Internet.user_name('Nancy') #=> "nancy"
|
177
|
+
|
178
|
+
Faker::Internet.user_name('Nancy Johnson', %w(. _ -)) #=> "johnson-nancy"
|
179
|
+
|
180
|
+
# Optional arguments: min_length=8, max_length=16
|
181
|
+
Faker::Internet.password #=> "vg5msvy1uerg7"
|
182
|
+
|
183
|
+
Faker::Internet.password(8) #=> "yfgjik0hgzdqs0"
|
184
|
+
|
185
|
+
Faker::Internet.password(10, 20) #=> "eoc9shwd1hwq4vbgfw"
|
186
|
+
|
187
|
+
Faker::Internet.domain_name #=> "effertz.info"
|
188
|
+
|
189
|
+
Faker::Internet.fix_umlauts('äöüß') #=> "aeoeuess"
|
190
|
+
|
191
|
+
Faker::Internet.domain_word #=> "haleyziemann"
|
192
|
+
|
193
|
+
Faker::Internet.domain_suffix #=> "info"
|
194
|
+
|
195
|
+
Faker::Internet.ip_v4_address #=> "24.29.18.175"
|
196
|
+
|
197
|
+
Faker::Internet.ip_v6_address #=> "ac5f:d696:3807:1d72:2eb5:4e81:7d2b:e1df"
|
198
|
+
|
199
|
+
# Optional argument prefix=''
|
200
|
+
Faker::Internet.mac_address #=> "e6:0d:00:11:ed:4f"
|
201
|
+
Faker::Internet.mac_address('55:44:33') #=> "55:44:33:02:1d:9b"
|
202
|
+
|
203
|
+
# Optional arguments: host=domain_name, path="/#{user_name}"
|
204
|
+
Faker::Internet.url #=> "http://thiel.com/chauncey_simonis"
|
205
|
+
Faker::Internet.url('example.com') #=> "http://example.com/clotilde.swift"
|
206
|
+
Faker::Internet.url('example.com', '/foobar.html') #=> "http://example.com/foobar.html"
|
207
|
+
|
208
|
+
# Optional arguments: words=nil, glue=nil
|
209
|
+
Faker::Internet.slug #=> "pariatur_laudantium"
|
210
|
+
Faker::Internet.slug('foo bar') #=> "foo.bar"
|
211
|
+
Faker::Internet.slug('foo bar', '-') #=> "foo-bar"
|
212
|
+
|
213
|
+
|
214
|
+
```
|
215
|
+
|
216
|
+
###Faker::Lorem
|
217
|
+
---------------
|
218
|
+
|
219
|
+
```ruby
|
220
|
+
|
221
|
+
Faker::Lorem.word #=> "repellendus"
|
222
|
+
|
223
|
+
# Optional arguments: num=3, supplemental=false
|
224
|
+
Faker::Lorem.words #=> ["dolores", "adipisci", "nesciunt"]
|
225
|
+
Faker::Lorem.words(4) #=> ["culpa", "recusandae", "aut", "omnis"]
|
226
|
+
Faker::Lorem.words(4, true) #=> ["colloco", "qui", "vergo", "deporto"]
|
227
|
+
|
228
|
+
# Optional arguments: char_count=255
|
229
|
+
Faker::Lorem.characters #=> "uw1ep04lhs0c4d931n1jmrspprf5wrj85fefue0y7y6m56b6omquh7br7dhqijwlawejpl765nb1716idmp3xnfo85v349pzy2o9rir23y2qhflwr71c1585fnynguiphkjm8p0vktwitcsm16lny7jzp9t4drwav3qmhz4yjq4k04x14gl6p148hulyqioo72tf8nwrxxcclfypz2lc58lsibgfe5w5p0xv95peafjjmm2frkhdc6duoky0aha"
|
230
|
+
Faker::Lorem.characters(10) #=> "ang9cbhoa8"
|
231
|
+
|
232
|
+
# Optional arguments: word_count=4, supplemental=false, random_words_to_add=6
|
233
|
+
Faker::Lorem.sentence #=> "Dolore illum animi et neque accusantium."
|
234
|
+
Faker::Lorem.sentence(3) #=> "Commodi qui minus deserunt sed vero quia."
|
235
|
+
Faker::Lorem.sentence(3, true) #=> "Inflammatio denego necessitatibus caelestis autus illum."
|
236
|
+
Faker::Lorem.sentence(3, false, 4) #=> "Aut voluptatem illum fugit ut sit."
|
237
|
+
Faker::Lorem.sentence(3, true, 4) #=> "Accusantium tantillus dolorem timor."
|
238
|
+
|
239
|
+
# Optional arguments: sentence_count=3, supplemental=false
|
240
|
+
Faker::Lorem.sentences #=> ["Vero earum commodi soluta.", "Quaerat fuga cumque et vero eveniet omnis ut.", "Cumque sit dolor ut est consequuntur."]
|
241
|
+
Faker::Lorem.sentences(1) #=> ["Ut perspiciatis explicabo possimus doloribus enim quia."]
|
242
|
+
Faker::Lorem.sentences(1, true) #=> ["Quis capillus curo ager veritatis voro et ipsum."]
|
243
|
+
|
244
|
+
# Optional arguments: sentence_count=3, supplemental=false, random_sentences_to_add=3
|
245
|
+
Faker::Lorem.paragraph #=> "Neque dicta enim quasi. Qui corrupti est quisquam. Facere animi quod aut. Qui nulla consequuntur consectetur sapiente."
|
246
|
+
Faker::Lorem.paragraph(2) #=> "Illo qui voluptas. Id sit quaerat enim aut cupiditate voluptates dolorum. Porro necessitatibus numquam dolor quia earum."
|
247
|
+
Faker::Lorem.paragraph(2, true) #=> ""
|
248
|
+
Faker::Lorem.paragraph(2, false, 4) #=> ""
|
249
|
+
Faker::Lorem.paragraph(2, true, 4) #=> ""
|
250
|
+
|
251
|
+
# Optional arguments: paragraph_count=3, supplemental=false
|
252
|
+
Faker::Lorem.paragraphs #=> ""
|
253
|
+
Faker::Lorem.paragraphs(1) #=> ""
|
254
|
+
Faker::Lorem.paragraphs(1, true) #=> ""
|
255
|
+
|
256
|
+
```
|
257
|
+
|
258
|
+
###Faker::Name
|
259
|
+
--------------
|
260
|
+
|
261
|
+
```ruby
|
262
|
+
|
263
|
+
Faker::Name.name #=> "Tyshawn Johns Sr."
|
264
|
+
|
265
|
+
Faker::Name.first_name #=> "Kaci"
|
266
|
+
|
267
|
+
Faker::Name.last_name #=> "Ernser"
|
268
|
+
|
269
|
+
Faker::Name.prefix #=> "Mr."
|
270
|
+
|
271
|
+
Faker::Name.suffix #=> "IV"
|
272
|
+
|
273
|
+
Faker::Name.title #=> "Legacy Creative Director"
|
274
|
+
|
275
|
+
```
|
276
|
+
|
277
|
+
###Faker::Avatar
|
278
|
+
----------------
|
279
|
+
|
280
|
+
```ruby
|
281
|
+
|
282
|
+
Faker::Avatar.image #=> "http://robohash.org/sitsequiquia.png?size=300x300"
|
283
|
+
|
284
|
+
Faker::Avatar.image("my-own-slug") #=> "http://robohash.org/my-own-slug.png?size=300x300"
|
285
|
+
|
286
|
+
Faker::Avatar.image("my-own-slug", "50x50") #=> "http://robohash.org/my-own-slug.png?size=50x50"
|
287
|
+
|
288
|
+
Faker::Avatar.image("my-own-slug", "50x50", "jpg") #=> "http://robohash.org/my-own-slug.jpg?size=50x50"
|
289
|
+
|
290
|
+
Faker::Avatar.image("my-own-slug", "50x50", "bmp") #=> "http://robohash.org/my-own-slug.bmp?size=50x50"
|
291
|
+
```
|
292
|
+
|
293
|
+
###Faker::Number
|
294
|
+
----------------
|
295
|
+
|
296
|
+
```ruby
|
297
|
+
|
298
|
+
# Required parameter: digits
|
299
|
+
Faker::Number.number(10) #=> "1968353479"
|
300
|
+
|
301
|
+
Faker::Number.digit #=> "1"
|
302
|
+
|
303
|
+
```
|
304
|
+
|
305
|
+
###Faker::PhoneNumber
|
306
|
+
---------------------
|
307
|
+
|
308
|
+
Phone numbers may be in any of the following formats:
|
309
|
+
|
310
|
+
* 333-333-3333
|
311
|
+
* (333) 333-3333
|
312
|
+
* 1-333-333-3333
|
313
|
+
* 333.333.3333
|
314
|
+
* 333-333-3333
|
315
|
+
* 333-333-3333 x3333
|
316
|
+
* (333) 333-3333 x3333
|
317
|
+
* 1-333-333-3333 x3333
|
318
|
+
* 333.333.3333 x3333
|
319
|
+
|
320
|
+
(Don't let the example output below fool you - any format can be returned at random.)
|
321
|
+
|
322
|
+
```ruby
|
323
|
+
|
324
|
+
Faker::PhoneNumber.phone_number #=> "397.693.1309"
|
325
|
+
|
326
|
+
Faker::PhoneNumber.cell_phone #=> "(186)285-7925"
|
327
|
+
|
328
|
+
# NOTE NOTE NOTE NOTE
|
329
|
+
# For the 'US only' methods below, first you must do the following:
|
330
|
+
Faker::Config.locale = 'en-US'
|
331
|
+
|
332
|
+
# US only
|
333
|
+
Faker::PhoneNumber.area_code #=> "201"
|
334
|
+
|
335
|
+
# US only
|
336
|
+
Faker::PhoneNumber.exchange_code #=> "208"
|
337
|
+
|
338
|
+
# Optional parameter: length=4
|
339
|
+
Faker::PhoneNumber.subscriber_number #=> "3873"
|
340
|
+
|
341
|
+
Faker::PhoneNumber.subscriber_number(2) #=> "39"
|
342
|
+
|
343
|
+
Faker::PhoneNumber.extension #=> "3764"
|
344
|
+
|
345
|
+
```
|
346
|
+
|
347
|
+
###Faker::Time
|
348
|
+
---------------------
|
349
|
+
|
350
|
+
```ruby
|
351
|
+
# Random date between dates
|
352
|
+
Faker::Time.between(2.days.ago, Time.now) #=> "2014-09-18 12:30:59 -0700"
|
353
|
+
|
354
|
+
# Random date between dates (within specified part of the day)
|
355
|
+
Faker::Time.between(2.days.ago, Time.now, :all) #=> "2014-09-19 07:03:30 -0700"
|
356
|
+
Faker::Time.between(2.days.ago, Time.now, :day) #=> "2014-09-18 16:28:13 -0700"
|
357
|
+
Faker::Time.between(2.days.ago, Time.now, :night) #=> "2014-09-20 19:39:38 -0700"
|
358
|
+
Faker::Time.between(2.days.ago, Time.now, :morning) #=> "2014-09-19 08:07:52 -0700"
|
359
|
+
Faker::Time.between(2.days.ago, Time.now, :afternoon) #=> "2014-09-18 12:10:34 -0700"
|
360
|
+
Faker::Time.between(2.days.ago, Time.now, :evening) #=> "2014-09-19 20:21:03 -0700"
|
361
|
+
Faker::Time.between(2.days.ago, Time.now, :midnight) #=> "2014-09-20 00:40:14 -0700"
|
362
|
+
|
363
|
+
# Random time in the future (up to maximum of N days)
|
364
|
+
Faker::Time.forward(23, :morning) # => "2014-09-26 06:54:47 -0700"
|
365
|
+
|
366
|
+
# Random time in the past (up to maximum of N days)
|
367
|
+
Faker::Time.backward(14, :evening) #=> "2014-09-17 19:56:33 -0700"
|
368
|
+
```
|
369
|
+
|
370
|
+
###Faker::Hacker
|
371
|
+
---------------------
|
372
|
+
Are you having trouble writing tech-savvy dialogue for your latest screenplay?
|
373
|
+
Worry not! Hollywood-grade technical talk is ready to fill out any form where you need to look smart.
|
374
|
+
|
375
|
+
```ruby
|
376
|
+
# Full Phrase
|
377
|
+
Faker::Hacker.say_something_smart #=> "Try to compress the SQL interface, maybe it will program the back-end hard drive!"
|
378
|
+
|
379
|
+
# Short technical abbreviations
|
380
|
+
Faker::Hacker.abbreviation #=> "RAM"
|
381
|
+
|
382
|
+
# Hacker centric adjectives
|
383
|
+
Faker::Hacker.adjective #=> "open-source"
|
384
|
+
|
385
|
+
# Only the best hacker related nouns
|
386
|
+
Faker::Hacker.noun #=> "bandwidth"
|
387
|
+
|
388
|
+
# Actions that hackers take
|
389
|
+
Faker::Hacker.verb #=> "bypass"
|
390
|
+
|
391
|
+
# Verbs that end in -ing
|
392
|
+
Faker::Hacker.ingverb #=> "synthesizing"
|
393
|
+
```
|
394
|
+
|
395
|
+
###Faker::App
|
396
|
+
-----------------
|
397
|
+
|
398
|
+
```ruby
|
399
|
+
|
400
|
+
Faker::App.name #=> "Treeflex"
|
401
|
+
|
402
|
+
Faker::App.version #=> "0.7.9"
|
403
|
+
|
404
|
+
Faker::App.author #=> "Daphne Swift"
|
405
|
+
|
406
|
+
```
|
407
|
+
|
408
|
+
Customization
|
409
|
+
------------
|
410
|
+
Since you may want to make addresses and other types of data look different
|
411
|
+
depending on where in the world you are (US postal codes vs. UK postal codes,
|
412
|
+
for example), Faker uses the I18n gem to store strings (like state names) and
|
413
|
+
formats (US postal codes are NNNNN while UK postal codes are AAN NAA),
|
414
|
+
allowing you to get different formats by switching locales. Just set
|
415
|
+
Faker::Config.locale to the locale you want, and Faker will take care of the
|
416
|
+
rest.
|
417
|
+
|
418
|
+
If your locale doesn't already exist, create it in the \lib\locales\ directory
|
419
|
+
and you can then override or add elements to suit
|
420
|
+
|
421
|
+
```yaml
|
422
|
+
|
423
|
+
en-au-ocker:
|
424
|
+
faker:
|
425
|
+
name:
|
426
|
+
# Exiting faker field, new data
|
427
|
+
first_name: [Charlotte, Ava, Chloe, Emily]
|
428
|
+
|
429
|
+
# New faker fields
|
430
|
+
ocker_first_name: [Bazza, Bluey, Davo, Johno, Shano, Shazza]
|
431
|
+
region: [South East Queensland, Wide Bay Burnett, Margaret River, Port Pirie, Gippsland, Elizabeth, Barossa]
|
432
|
+
|
433
|
+
```
|
434
|
+
|
435
|
+
Contributing
|
436
|
+
------------
|
437
|
+
See [CONTRIBUTING.md](https://github.com/factory-helper/factory-helper/blob/master/CONTRIBUTING.md).
|
438
|
+
|
439
|
+
Contact
|
440
|
+
-------
|
441
|
+
Comments and feedback are welcome. Send an email to public88878878887@hotmail.com.
|
442
|
+
|
443
|
+
License
|
444
|
+
-------
|
445
|
+
This code is free to use under the terms of the MIT license.
|