rfauxfactory 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: f9d9a10ac723208b86ebdf0890310a4ad010a86f
4
+ data.tar.gz: 6e484b256fc98a51e007f44de03d6b8440f8ddf9
5
+ SHA512:
6
+ metadata.gz: 2d09578f209acd7d3519d2dead059e5a19f32a1757f44ae342f8e18049a9ec73efb526807ae31803b95695324c1586ec465b6381ba0b5034b8ae66a2a5f365ab
7
+ data.tar.gz: a4e8fb2f8d0b7c850244d5d154da96f709e2360512f290eb45f55eba2567213ccce47a3520551496ab335e3007798bb919192a2219d5a0f6f910ed8a9d7a2d1d
data/.gitignore ADDED
@@ -0,0 +1,53 @@
1
+ *.gem
2
+ *.rbc
3
+ /.config
4
+ /coverage/
5
+ /InstalledFiles
6
+ /pkg/
7
+ /spec/reports/
8
+ /spec/examples.txt
9
+ /test/tmp/
10
+ /test/version_tmp/
11
+ /tmp/
12
+
13
+ # For Rubymine
14
+ /.idea
15
+
16
+ # Used by dotenv library to load environment variables.
17
+ # .env
18
+
19
+ ## Specific to RubyMotion:
20
+ .dat*
21
+ .repl_history
22
+ build/
23
+ *.bridgesupport
24
+ build-iPhoneOS/
25
+ build-iPhoneSimulator/
26
+
27
+ ## Specific to RubyMotion (use of CocoaPods):
28
+ #
29
+ # We recommend against adding the Pods directory to your .gitignore. However
30
+ # you should judge for yourself, the pros and cons are mentioned at:
31
+ # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
32
+ #
33
+ # vendor/Pods/
34
+
35
+ ## Documentation cache and generated files:
36
+ /.yardoc/
37
+ /_yardoc/
38
+ /doc/
39
+ /rdoc/
40
+
41
+ ## Environment normalization:
42
+ /.bundle/
43
+ /vendor/bundle
44
+ /lib/bundler/man/
45
+
46
+ # for a library or gem, you might want to ignore these files since the code is
47
+ # intended to run in multiple environments; otherwise, check them in:
48
+ # Gemfile.lock
49
+ # .ruby-version
50
+ # .ruby-gemset
51
+
52
+ # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
53
+ .rvmrc
data/.rubocop.yml ADDED
@@ -0,0 +1,24 @@
1
+ Documentation:
2
+ Enabled: false
3
+
4
+ StringLiterals:
5
+ Enabled: false
6
+
7
+ SpaceInsideHashLiteralBraces:
8
+ Enabled: false
9
+
10
+ Encoding:
11
+ Enabled: false
12
+
13
+ LineLength:
14
+ Max: 119
15
+
16
+ MethodLength:
17
+ Max: 20
18
+
19
+ ModuleLength:
20
+ Enabled: false
21
+
22
+ NumericLiterals:
23
+ Enabled: false
24
+
data/Gemfile ADDED
@@ -0,0 +1,11 @@
1
+ source "https://rubygems.org"
2
+
3
+ gemspec
4
+
5
+ group :development, :test do
6
+ gem "minitest"
7
+ gem "pry"
8
+ gem "rake"
9
+ gem "rubocop-checkstyle_formatter"
10
+ gem "test-unit"
11
+ end
data/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
data/README.md ADDED
@@ -0,0 +1,2 @@
1
+ # RFauxFactory
2
+ Generates random data for your tests. Ruby port for https://github.com/omaciel/fauxfactory.
data/Rakefile ADDED
@@ -0,0 +1,20 @@
1
+ require "bundler/gem_tasks"
2
+ require "rake/testtask"
3
+
4
+ begin
5
+ require 'rubocop/rake_task'
6
+ RuboCop::RakeTask.new
7
+ rescue LoadError
8
+ puts "Rubocop not loaded"
9
+ end
10
+
11
+ Rake::TestTask.new(:test) do |t|
12
+ t.libs << "test"
13
+ t.libs << "lib"
14
+ t.test_files = FileList["test/**/*_test.rb"]
15
+ end
16
+
17
+ task :default do
18
+ Rake::Task['rubocop'].execute
19
+ Rake::Task['test'].execute
20
+ end
data/bin/console ADDED
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "rfauxfactory"
5
+
6
+ require "pry"
7
+ Pry.start
data/bin/setup ADDED
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
@@ -0,0 +1,617 @@
1
+ module RFauxFactory
2
+ N_BYTES = [42].pack('i').size
3
+ N_BITS = N_BYTES * 16
4
+ MAX_INT = 2**(N_BITS - 2) - 1
5
+ MIN_INT = -MAX_INT - 1
6
+ ASCII_LOWERCASE = 'abcdefghijklmnopqrstuvwxyz'.freeze
7
+ ASCII_UPPERCASE = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'.freeze
8
+ PUNCTUATION = '!"#$%&\'()*+,-./:;<=>?@[\]^_`{|}~'.freeze
9
+ ASCII_LETTERS = ASCII_LOWERCASE + ASCII_UPPERCASE
10
+ DIGITS = '0123456789'.freeze
11
+ ALPHANUMERIC = ASCII_LETTERS + DIGITS
12
+ HTML_TAGS = %w[
13
+ a abbr acronym address applet area b
14
+ base basefont bdo big blink blockquote body br
15
+ button caption center cite code col colgroup
16
+ dd del dfn dir div dl dt
17
+ em fieldset font form frame frameset h1
18
+ h2 h3 h4 h5 h6 head hr
19
+ html i iframe img input ins isindex
20
+ kbd label legend li link map menu
21
+ meta noframes noscript object ol optgroup option
22
+ p param pre q s samp script
23
+ select small span strike strong style sub
24
+ sup table tbody td textarea tfoot th
25
+ thead title tr tt u ul var
26
+ ].freeze
27
+ CJK_LETTERS_RANGE = (0x4E00..0x9FCC)
28
+ CYRILLIC_LETTERS_RANGE = (0x0400..0x04FF)
29
+ UNICODE_LETTERS_RANGES = [
30
+ (65..90),
31
+ (97..122),
32
+ (170..170),
33
+ (181..181),
34
+ (186..186),
35
+ (192..214),
36
+ (216..246),
37
+ (248..705),
38
+ (710..721),
39
+ (736..740),
40
+ (748..748),
41
+ (750..750),
42
+ (880..884),
43
+ (886..887),
44
+ (890..893),
45
+ (895..895),
46
+ (902..902),
47
+ (904..906),
48
+ (908..908),
49
+ (910..929),
50
+ (931..1013),
51
+ (1015..1153),
52
+ (1162..1327),
53
+ (1329..1366),
54
+ (1369..1369),
55
+ (1377..1415),
56
+ (1488..1514),
57
+ (1520..1522),
58
+ (1568..1610),
59
+ (1646..1647),
60
+ (1649..1747),
61
+ (1749..1749),
62
+ (1765..1766),
63
+ (1774..1775),
64
+ (1786..1788),
65
+ (1791..1791),
66
+ (1808..1808),
67
+ (1810..1839),
68
+ (1869..1957),
69
+ (1969..1969),
70
+ (1994..2026),
71
+ (2036..2037),
72
+ (2042..2042),
73
+ (2048..2069),
74
+ (2074..2074),
75
+ (2084..2084),
76
+ (2088..2088),
77
+ (2112..2136),
78
+ (2208..2228),
79
+ (2230..2237),
80
+ (2308..2361),
81
+ (2365..2365),
82
+ (2384..2384),
83
+ (2392..2401),
84
+ (2417..2432),
85
+ (2437..2444),
86
+ (2447..2448),
87
+ (2451..2472),
88
+ (2474..2480),
89
+ (2482..2482),
90
+ (2486..2489),
91
+ (2493..2493),
92
+ (2510..2510),
93
+ (2524..2525),
94
+ (2527..2529),
95
+ (2544..2545),
96
+ (2565..2570),
97
+ (2575..2576),
98
+ (2579..2600),
99
+ (2602..2608),
100
+ (2610..2611),
101
+ (2613..2614),
102
+ (2616..2617),
103
+ (2649..2652),
104
+ (2654..2654),
105
+ (2674..2676),
106
+ (2693..2701),
107
+ (2703..2705),
108
+ (2707..2728),
109
+ (2730..2736),
110
+ (2738..2739),
111
+ (2741..2745),
112
+ (2749..2749),
113
+ (2768..2768),
114
+ (2784..2785),
115
+ (2809..2809),
116
+ (2821..2828),
117
+ (2831..2832),
118
+ (2835..2856),
119
+ (2858..2864),
120
+ (2866..2867),
121
+ (2869..2873),
122
+ (2877..2877),
123
+ (2908..2909),
124
+ (2911..2913),
125
+ (2929..2929),
126
+ (2947..2947),
127
+ (2949..2954),
128
+ (2958..2960),
129
+ (2962..2965),
130
+ (2969..2970),
131
+ (2972..2972),
132
+ (2974..2975),
133
+ (2979..2980),
134
+ (2984..2986),
135
+ (2990..3001),
136
+ (3024..3024),
137
+ (3077..3084),
138
+ (3086..3088),
139
+ (3090..3112),
140
+ (3114..3129),
141
+ (3133..3133),
142
+ (3160..3162),
143
+ (3168..3169),
144
+ (3200..3200),
145
+ (3205..3212),
146
+ (3214..3216),
147
+ (3218..3240),
148
+ (3242..3251),
149
+ (3253..3257),
150
+ (3261..3261),
151
+ (3294..3294),
152
+ (3296..3297),
153
+ (3313..3314),
154
+ (3333..3340),
155
+ (3342..3344),
156
+ (3346..3386),
157
+ (3389..3389),
158
+ (3406..3406),
159
+ (3412..3414),
160
+ (3423..3425),
161
+ (3450..3455),
162
+ (3461..3478),
163
+ (3482..3505),
164
+ (3507..3515),
165
+ (3517..3517),
166
+ (3520..3526),
167
+ (3585..3632),
168
+ (3634..3635),
169
+ (3648..3654),
170
+ (3713..3714),
171
+ (3716..3716),
172
+ (3719..3720),
173
+ (3722..3722),
174
+ (3725..3725),
175
+ (3732..3735),
176
+ (3737..3743),
177
+ (3745..3747),
178
+ (3749..3749),
179
+ (3751..3751),
180
+ (3754..3755),
181
+ (3757..3760),
182
+ (3762..3763),
183
+ (3773..3773),
184
+ (3776..3780),
185
+ (3782..3782),
186
+ (3804..3807),
187
+ (3840..3840),
188
+ (3904..3911),
189
+ (3913..3948),
190
+ (3976..3980),
191
+ (4096..4138),
192
+ (4159..4159),
193
+ (4176..4181),
194
+ (4186..4189),
195
+ (4193..4193),
196
+ (4197..4198),
197
+ (4206..4208),
198
+ (4213..4225),
199
+ (4238..4238),
200
+ (4256..4293),
201
+ (4295..4295),
202
+ (4301..4301),
203
+ (4304..4346),
204
+ (4348..4680),
205
+ (4682..4685),
206
+ (4688..4694),
207
+ (4696..4696),
208
+ (4698..4701),
209
+ (4704..4744),
210
+ (4746..4749),
211
+ (4752..4784),
212
+ (4786..4789),
213
+ (4792..4798),
214
+ (4800..4800),
215
+ (4802..4805),
216
+ (4808..4822),
217
+ (4824..4880),
218
+ (4882..4885),
219
+ (4888..4954),
220
+ (4992..5007),
221
+ (5024..5109),
222
+ (5112..5117),
223
+ (5121..5740),
224
+ (5743..5759),
225
+ (5761..5786),
226
+ (5792..5866),
227
+ (5873..5880),
228
+ (5888..5900),
229
+ (5902..5905),
230
+ (5920..5937),
231
+ (5952..5969),
232
+ (5984..5996),
233
+ (5998..6000),
234
+ (6016..6067),
235
+ (6103..6103),
236
+ (6108..6108),
237
+ (6176..6263),
238
+ (6272..6276),
239
+ (6279..6312),
240
+ (6314..6314),
241
+ (6320..6389),
242
+ (6400..6430),
243
+ (6480..6509),
244
+ (6512..6516),
245
+ (6528..6571),
246
+ (6576..6601),
247
+ (6656..6678),
248
+ (6688..6740),
249
+ (6823..6823),
250
+ (6917..6963),
251
+ (6981..6987),
252
+ (7043..7072),
253
+ (7086..7087),
254
+ (7098..7141),
255
+ (7168..7203),
256
+ (7245..7247),
257
+ (7258..7293),
258
+ (7296..7304),
259
+ (7401..7404),
260
+ (7406..7409),
261
+ (7413..7414),
262
+ (7424..7615),
263
+ (7680..7957),
264
+ (7960..7965),
265
+ (7968..8005),
266
+ (8008..8013),
267
+ (8016..8023),
268
+ (8025..8025),
269
+ (8027..8027),
270
+ (8029..8029),
271
+ (8031..8061),
272
+ (8064..8116),
273
+ (8118..8124),
274
+ (8126..8126),
275
+ (8130..8132),
276
+ (8134..8140),
277
+ (8144..8147),
278
+ (8150..8155),
279
+ (8160..8172),
280
+ (8178..8180),
281
+ (8182..8188),
282
+ (8305..8305),
283
+ (8319..8319),
284
+ (8336..8348),
285
+ (8450..8450),
286
+ (8455..8455),
287
+ (8458..8467),
288
+ (8469..8469),
289
+ (8473..8477),
290
+ (8484..8484),
291
+ (8486..8486),
292
+ (8488..8488),
293
+ (8490..8493),
294
+ (8495..8505),
295
+ (8508..8511),
296
+ (8517..8521),
297
+ (8526..8526),
298
+ (8579..8580),
299
+ (11264..11310),
300
+ (11312..11358),
301
+ (11360..11492),
302
+ (11499..11502),
303
+ (11506..11507),
304
+ (11520..11557),
305
+ (11559..11559),
306
+ (11565..11565),
307
+ (11568..11623),
308
+ (11631..11631),
309
+ (11648..11670),
310
+ (11680..11686),
311
+ (11688..11694),
312
+ (11696..11702),
313
+ (11704..11710),
314
+ (11712..11718),
315
+ (11720..11726),
316
+ (11728..11734),
317
+ (11736..11742),
318
+ (11823..11823),
319
+ (12293..12294),
320
+ (12337..12341),
321
+ (12347..12348),
322
+ (12353..12438),
323
+ (12445..12447),
324
+ (12449..12538),
325
+ (12540..12543),
326
+ (12549..12589),
327
+ (12593..12686),
328
+ (12704..12730),
329
+ (12784..12799),
330
+ (13312..19893),
331
+ (19968..40917),
332
+ (40960..42124),
333
+ (42192..42237),
334
+ (42240..42508),
335
+ (42512..42527),
336
+ (42538..42539),
337
+ (42560..42606),
338
+ (42623..42653),
339
+ (42656..42725),
340
+ (42775..42783),
341
+ (42786..42888),
342
+ (42891..42926),
343
+ (42928..42935),
344
+ (42999..43009),
345
+ (43011..43013),
346
+ (43015..43018),
347
+ (43020..43042),
348
+ (43072..43123),
349
+ (43138..43187),
350
+ (43250..43255),
351
+ (43259..43259),
352
+ (43261..43261),
353
+ (43274..43301),
354
+ (43312..43334),
355
+ (43360..43388),
356
+ (43396..43442),
357
+ (43471..43471),
358
+ (43488..43492),
359
+ (43494..43503),
360
+ (43514..43518),
361
+ (43520..43560),
362
+ (43584..43586),
363
+ (43588..43595),
364
+ (43616..43638),
365
+ (43642..43642),
366
+ (43646..43695),
367
+ (43697..43697),
368
+ (43701..43702),
369
+ (43705..43709),
370
+ (43712..43712),
371
+ (43714..43714),
372
+ (43739..43741),
373
+ (43744..43754),
374
+ (43762..43764),
375
+ (43777..43782),
376
+ (43785..43790),
377
+ (43793..43798),
378
+ (43808..43814),
379
+ (43816..43822),
380
+ (43824..43866),
381
+ (43868..43877),
382
+ (43888..44002),
383
+ (44032..55203),
384
+ (55216..55238),
385
+ (55243..55291),
386
+ (63744..64109),
387
+ (64112..64217),
388
+ (64256..64262),
389
+ (64275..64279),
390
+ (64285..64285),
391
+ (64287..64296),
392
+ (64298..64310),
393
+ (64312..64316),
394
+ (64318..64318),
395
+ (64320..64321),
396
+ (64323..64324),
397
+ (64326..64433),
398
+ (64467..64829),
399
+ (64848..64911),
400
+ (64914..64967),
401
+ (65008..65019),
402
+ (65136..65140),
403
+ (65142..65276),
404
+ (65313..65338),
405
+ (65345..65370),
406
+ (65382..65470),
407
+ (65474..65479),
408
+ (65482..65487),
409
+ (65490..65495),
410
+ (65498..65500),
411
+ (65536..65547),
412
+ (65549..65574),
413
+ (65576..65594),
414
+ (65596..65597),
415
+ (65599..65613),
416
+ (65616..65629),
417
+ (65664..65786),
418
+ (66176..66204),
419
+ (66208..66256),
420
+ (66304..66335),
421
+ (66352..66368),
422
+ (66370..66377),
423
+ (66384..66421),
424
+ (66432..66461),
425
+ (66464..66499),
426
+ (66504..66511),
427
+ (66560..66717),
428
+ (66736..66771),
429
+ (66776..66811),
430
+ (66816..66855),
431
+ (66864..66915),
432
+ (67072..67382),
433
+ (67392..67413),
434
+ (67424..67431),
435
+ (67584..67589),
436
+ (67592..67592),
437
+ (67594..67637),
438
+ (67639..67640),
439
+ (67644..67644),
440
+ (67647..67669),
441
+ (67680..67702),
442
+ (67712..67742),
443
+ (67808..67826),
444
+ (67828..67829),
445
+ (67840..67861),
446
+ (67872..67897),
447
+ (67968..68023),
448
+ (68030..68031),
449
+ (68096..68096),
450
+ (68112..68115),
451
+ (68117..68119),
452
+ (68121..68147),
453
+ (68192..68220),
454
+ (68224..68252),
455
+ (68288..68295),
456
+ (68297..68324),
457
+ (68352..68405),
458
+ (68416..68437),
459
+ (68448..68466),
460
+ (68480..68497),
461
+ (68608..68680),
462
+ (68736..68786),
463
+ (68800..68850),
464
+ (69635..69687),
465
+ (69763..69807),
466
+ (69840..69864),
467
+ (69891..69926),
468
+ (69968..70002),
469
+ (70006..70006),
470
+ (70019..70066),
471
+ (70081..70084),
472
+ (70106..70106),
473
+ (70108..70108),
474
+ (70144..70161),
475
+ (70163..70187),
476
+ (70272..70278),
477
+ (70280..70280),
478
+ (70282..70285),
479
+ (70287..70301),
480
+ (70303..70312),
481
+ (70320..70366),
482
+ (70405..70412),
483
+ (70415..70416),
484
+ (70419..70440),
485
+ (70442..70448),
486
+ (70450..70451),
487
+ (70453..70457),
488
+ (70461..70461),
489
+ (70480..70480),
490
+ (70493..70497),
491
+ (70656..70708),
492
+ (70727..70730),
493
+ (70784..70831),
494
+ (70852..70853),
495
+ (70855..70855),
496
+ (71040..71086),
497
+ (71128..71131),
498
+ (71168..71215),
499
+ (71236..71236),
500
+ (71296..71338),
501
+ (71424..71449),
502
+ (71840..71903),
503
+ (71935..71935),
504
+ (72384..72440),
505
+ (72704..72712),
506
+ (72714..72750),
507
+ (72768..72768),
508
+ (72818..72847),
509
+ (73728..74649),
510
+ (74880..75075),
511
+ (77824..78894),
512
+ (82944..83526),
513
+ (92160..92728),
514
+ (92736..92766),
515
+ (92880..92909),
516
+ (92928..92975),
517
+ (92992..92995),
518
+ (93027..93047),
519
+ (93053..93071),
520
+ (93952..94020),
521
+ (94032..94032),
522
+ (94099..94111),
523
+ (94176..94176),
524
+ (94208..100332),
525
+ (100352..101106),
526
+ (110592..110593),
527
+ (113664..113770),
528
+ (113776..113788),
529
+ (113792..113800),
530
+ (113808..113817),
531
+ (119808..119892),
532
+ (119894..119964),
533
+ (119966..119967),
534
+ (119970..119970),
535
+ (119973..119974),
536
+ (119977..119980),
537
+ (119982..119993),
538
+ (119995..119995),
539
+ (119997..120003),
540
+ (120005..120069),
541
+ (120071..120074),
542
+ (120077..120084),
543
+ (120086..120092),
544
+ (120094..120121),
545
+ (120123..120126),
546
+ (120128..120132),
547
+ (120134..120134),
548
+ (120138..120144),
549
+ (120146..120485),
550
+ (120488..120512),
551
+ (120514..120538),
552
+ (120540..120570),
553
+ (120572..120596),
554
+ (120598..120628),
555
+ (120630..120654),
556
+ (120656..120686),
557
+ (120688..120712),
558
+ (120714..120744),
559
+ (120746..120770),
560
+ (120772..120779),
561
+ (124928..125124),
562
+ (125184..125251),
563
+ (126464..126467),
564
+ (126469..126495),
565
+ (126497..126498),
566
+ (126500..126500),
567
+ (126503..126503),
568
+ (126505..126514),
569
+ (126516..126519),
570
+ (126521..126521),
571
+ (126523..126523),
572
+ (126530..126530),
573
+ (126535..126535),
574
+ (126537..126537),
575
+ (126539..126539),
576
+ (126541..126543),
577
+ (126545..126546),
578
+ (126548..126548),
579
+ (126551..126551),
580
+ (126553..126553),
581
+ (126555..126555),
582
+ (126557..126557),
583
+ (126559..126559),
584
+ (126561..126562),
585
+ (126564..126564),
586
+ (126567..126570),
587
+ (126572..126578),
588
+ (126580..126583),
589
+ (126585..126588),
590
+ (126590..126590),
591
+ (126592..126601),
592
+ (126603..126619),
593
+ (126625..126627),
594
+ (126629..126633),
595
+ (126635..126651),
596
+ (131072..173782),
597
+ (173824..177972),
598
+ (177984..178205),
599
+ (178208..183969),
600
+ (194560..195101)
601
+ ].freeze
602
+ UNICODE_LETTERS = UNICODE_LETTERS_RANGES.map do |urange|
603
+ urange.map do |codepoint|
604
+ codepoint.chr(Encoding::UTF_8)
605
+ end
606
+ end.flatten
607
+ LATIN_LETTERS_RANGES = [
608
+ (0x00C0..0x00D6),
609
+ (0x00D8..0x00F6),
610
+ (0x00F8..0x00FF)
611
+ ].freeze
612
+ LATIN_LETTERS = LATIN_LETTERS_RANGES.map do |latin_range|
613
+ latin_range.map do |codepoint|
614
+ codepoint.chr(Encoding::UTF_8)
615
+ end
616
+ end.flatten
617
+ end
@@ -0,0 +1,3 @@
1
+ module RFauxFactory
2
+ VERSION = "0.1.0".freeze
3
+ end
@@ -0,0 +1,105 @@
1
+ require "rfauxfactory/version"
2
+ require "rfauxfactory/constants"
3
+
4
+ # The python FauxFactory port
5
+ module RFauxFactory
6
+ class << self
7
+ private
8
+
9
+ def gen_string_from_letters(length, letters)
10
+ max_index = letters.length - 1
11
+ (1..length).map do
12
+ letters[rand(max_index)].chr
13
+ end.join
14
+ end
15
+
16
+ def gen_string_from_cp_range(length, max_or_range)
17
+ (1..length).map do
18
+ char_ascii = rand(max_or_range)
19
+ char_ascii.chr(Encoding::UTF_8)
20
+ end.join
21
+ end
22
+
23
+ def positive_int!(length)
24
+ raise TypeError, 'length is not of type Integer' unless length.is_a? Integer
25
+ raise ArgumentError, 'length must be a positive integer' if length <= 0
26
+ end
27
+
28
+ public
29
+
30
+ # Returns a random string made up of alpha characters.
31
+ def gen_alpha(length = 10)
32
+ positive_int! length
33
+ gen_string_from_letters length, ASCII_LETTERS
34
+ end
35
+
36
+ # Returns a random string made up of alpha and numeric characters.
37
+ def gen_alphanumeric(length = 10)
38
+ positive_int! length
39
+ gen_string_from_letters length, ALPHANUMERIC
40
+ end
41
+
42
+ # Returns a random string made up of CJK characters.
43
+ def gen_cjk(length = 10)
44
+ positive_int! length
45
+ gen_string_from_cp_range length, CJK_LETTERS_RANGE
46
+ end
47
+
48
+ def gen_utf8(length = 10)
49
+ positive_int! length
50
+ gen_string_from_letters length, UNICODE_LETTERS
51
+ end
52
+
53
+ # Returns a random string made up of UTF-8 characters.
54
+ # (Font: Wikipedia - Latin-1 Supplement Unicode Block)
55
+ def gen_latin1(length = 10)
56
+ positive_int! length
57
+ gen_string_from_letters length, LATIN_LETTERS
58
+ end
59
+
60
+ # Returns a random string made up of Cyrillic characters.
61
+ def gen_cyrillic(length = 10)
62
+ positive_int! length
63
+ gen_string_from_cp_range length, CYRILLIC_LETTERS_RANGE
64
+ end
65
+
66
+ # Returns a random string made up of numbers.
67
+ def gen_numeric_string(length = 10)
68
+ positive_int! length
69
+ gen_string_from_letters length, DIGITS
70
+ end
71
+
72
+ # Returns a random string made up of html characters.
73
+ def gen_html(length = 10)
74
+ positive_int! length
75
+ html_tag = HTML_TAGS.sample
76
+ "<#{html_tag}>#{gen_alpha(length)}</#{html_tag}>"
77
+ end
78
+
79
+ def gen_boolean
80
+ [true, false].sample
81
+ end
82
+
83
+ def gen_special(length = 10)
84
+ positive_int! length
85
+ gen_string_from_letters length, PUNCTUATION
86
+ end
87
+
88
+ # A simple wrapper that calls other string generation methods.
89
+ def gen_string(str_type, length = 10)
90
+ func_str_types = {
91
+ 'alpha': :gen_alpha,
92
+ 'alphanumeric': :gen_alphanumeric,
93
+ 'cjk': :gen_cjk,
94
+ 'cyrillic': :gen_cyrillic,
95
+ 'html': :gen_html,
96
+ 'latin1': :gen_latin1,
97
+ 'numeric': :gen_numeric_string,
98
+ 'utf8': :gen_utf8,
99
+ 'punctuation': :gen_special
100
+ }
101
+ raise ArgumentError, "str_type: #{str_type} not supported" unless func_str_types.key?(str_type)
102
+ send(func_str_types[str_type], length)
103
+ end
104
+ end
105
+ end
@@ -0,0 +1,26 @@
1
+
2
+ lib = File.expand_path("../lib", __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'rfauxfactory/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "rfauxfactory"
8
+ spec.version = RFauxFactory::VERSION
9
+ spec.authors = ['Og Maciel']
10
+ spec.email = ['omaciel@ogmaciel.com']
11
+ spec.summary = 'Generates random data for your tests.'
12
+ spec.description = 'Generates random data for your tests. Ruby port for https://github.com/omaciel/fauxfactory.'
13
+ spec.homepage = 'https://github.com/SatelliteQE/RFauxFactory'
14
+ spec.license = 'Apache 2.0'
15
+
16
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
17
+ f.match(%r{^(test|spec|features)/})
18
+ end
19
+ spec.bindir = "exe"
20
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
21
+ spec.require_paths = ["lib"]
22
+
23
+ spec.add_development_dependency "bundler", "~> 1.16"
24
+ spec.add_development_dependency "minitest", "~> 5.0"
25
+ spec.add_development_dependency "rake", "~> 10.0"
26
+ end
metadata ADDED
@@ -0,0 +1,98 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rfauxfactory
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Og Maciel
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2018-02-27 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.16'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.16'
27
+ - !ruby/object:Gem::Dependency
28
+ name: minitest
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '5.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '5.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '10.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '10.0'
55
+ description: Generates random data for your tests. Ruby port for https://github.com/omaciel/fauxfactory.
56
+ email:
57
+ - omaciel@ogmaciel.com
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - ".gitignore"
63
+ - ".rubocop.yml"
64
+ - Gemfile
65
+ - LICENSE
66
+ - README.md
67
+ - Rakefile
68
+ - bin/console
69
+ - bin/setup
70
+ - lib/rfauxfactory.rb
71
+ - lib/rfauxfactory/constants.rb
72
+ - lib/rfauxfactory/version.rb
73
+ - rfauxfactory.gemspec
74
+ homepage: https://github.com/SatelliteQE/RFauxFactory
75
+ licenses:
76
+ - Apache 2.0
77
+ metadata: {}
78
+ post_install_message:
79
+ rdoc_options: []
80
+ require_paths:
81
+ - lib
82
+ required_ruby_version: !ruby/object:Gem::Requirement
83
+ requirements:
84
+ - - ">="
85
+ - !ruby/object:Gem::Version
86
+ version: '0'
87
+ required_rubygems_version: !ruby/object:Gem::Requirement
88
+ requirements:
89
+ - - ">="
90
+ - !ruby/object:Gem::Version
91
+ version: '0'
92
+ requirements: []
93
+ rubyforge_project:
94
+ rubygems_version: 2.4.5.1
95
+ signing_key:
96
+ specification_version: 4
97
+ summary: Generates random data for your tests.
98
+ test_files: []