blackbox 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (80) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +15 -0
  3. data/.rspec +2 -0
  4. data/Gemfile +4 -0
  5. data/LICENSE.txt +374 -0
  6. data/README.md +34 -0
  7. data/Rakefile +31 -0
  8. data/blackbox.gemspec +25 -0
  9. data/coverage/.last_run.json +5 -0
  10. data/coverage/.resultset.json +323 -0
  11. data/coverage/assets/0.7.1/application.css +1110 -0
  12. data/coverage/assets/0.7.1/application.js +626 -0
  13. data/coverage/assets/0.7.1/fancybox/blank.gif +0 -0
  14. data/coverage/assets/0.7.1/fancybox/fancy_close.png +0 -0
  15. data/coverage/assets/0.7.1/fancybox/fancy_loading.png +0 -0
  16. data/coverage/assets/0.7.1/fancybox/fancy_nav_left.png +0 -0
  17. data/coverage/assets/0.7.1/fancybox/fancy_nav_right.png +0 -0
  18. data/coverage/assets/0.7.1/fancybox/fancy_shadow_e.png +0 -0
  19. data/coverage/assets/0.7.1/fancybox/fancy_shadow_n.png +0 -0
  20. data/coverage/assets/0.7.1/fancybox/fancy_shadow_ne.png +0 -0
  21. data/coverage/assets/0.7.1/fancybox/fancy_shadow_nw.png +0 -0
  22. data/coverage/assets/0.7.1/fancybox/fancy_shadow_s.png +0 -0
  23. data/coverage/assets/0.7.1/fancybox/fancy_shadow_se.png +0 -0
  24. data/coverage/assets/0.7.1/fancybox/fancy_shadow_sw.png +0 -0
  25. data/coverage/assets/0.7.1/fancybox/fancy_shadow_w.png +0 -0
  26. data/coverage/assets/0.7.1/fancybox/fancy_title_left.png +0 -0
  27. data/coverage/assets/0.7.1/fancybox/fancy_title_main.png +0 -0
  28. data/coverage/assets/0.7.1/fancybox/fancy_title_over.png +0 -0
  29. data/coverage/assets/0.7.1/fancybox/fancy_title_right.png +0 -0
  30. data/coverage/assets/0.7.1/fancybox/fancybox-x.png +0 -0
  31. data/coverage/assets/0.7.1/fancybox/fancybox-y.png +0 -0
  32. data/coverage/assets/0.7.1/fancybox/fancybox.png +0 -0
  33. data/coverage/assets/0.7.1/favicon_green.png +0 -0
  34. data/coverage/assets/0.7.1/favicon_red.png +0 -0
  35. data/coverage/assets/0.7.1/favicon_yellow.png +0 -0
  36. data/coverage/assets/0.7.1/loading.gif +0 -0
  37. data/coverage/assets/0.7.1/magnify.png +0 -0
  38. data/coverage/assets/0.7.1/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
  39. data/coverage/assets/0.7.1/smoothness/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
  40. data/coverage/assets/0.7.1/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
  41. data/coverage/assets/0.7.1/smoothness/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
  42. data/coverage/assets/0.7.1/smoothness/images/ui-bg_glass_75_dadada_1x400.png +0 -0
  43. data/coverage/assets/0.7.1/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
  44. data/coverage/assets/0.7.1/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
  45. data/coverage/assets/0.7.1/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
  46. data/coverage/assets/0.7.1/smoothness/images/ui-icons_222222_256x240.png +0 -0
  47. data/coverage/assets/0.7.1/smoothness/images/ui-icons_2e83ff_256x240.png +0 -0
  48. data/coverage/assets/0.7.1/smoothness/images/ui-icons_454545_256x240.png +0 -0
  49. data/coverage/assets/0.7.1/smoothness/images/ui-icons_888888_256x240.png +0 -0
  50. data/coverage/assets/0.7.1/smoothness/images/ui-icons_cd0a0a_256x240.png +0 -0
  51. data/coverage/index.html +2080 -0
  52. data/doc/BB.html +129 -0
  53. data/doc/BB/Crypto.html +1145 -0
  54. data/doc/BB/Hash.html +441 -0
  55. data/doc/BB/String.html +240 -0
  56. data/doc/_index.html +155 -0
  57. data/doc/class_list.html +53 -0
  58. data/doc/css/common.css +1 -0
  59. data/doc/css/full_list.css +57 -0
  60. data/doc/css/style.css +338 -0
  61. data/doc/file.README.html +104 -0
  62. data/doc/file_list.html +55 -0
  63. data/doc/frames.html +28 -0
  64. data/doc/index.html +104 -0
  65. data/doc/js/app.js +214 -0
  66. data/doc/js/full_list.js +173 -0
  67. data/doc/js/jquery.js +4 -0
  68. data/doc/method_list.html +124 -0
  69. data/doc/top-level-namespace.html +112 -0
  70. data/lib/blackbox.rb +4 -0
  71. data/lib/blackbox/crypto.rb +99 -0
  72. data/lib/blackbox/hash.rb +49 -0
  73. data/lib/blackbox/string.rb +17 -0
  74. data/lib/blackbox/version.rb +3 -0
  75. data/spec/blackbox_spec.rb +9 -0
  76. data/spec/crypto_spec.rb +70 -0
  77. data/spec/hash_spec.rb +51 -0
  78. data/spec/spec_helper.rb +4 -0
  79. data/spec/string_spec.rb +13 -0
  80. metadata +184 -0
@@ -0,0 +1,2080 @@
1
+ <!DOCTYPE html>
2
+ <html xmlns='http://www.w3.org/1999/xhtml'>
3
+ <head>
4
+ <title>Code coverage for Blackbox</title>
5
+ <meta http-equiv="content-type" content="text/html; charset=utf-8" />
6
+ <script src='./assets/0.7.1/application.js' type='text/javascript'></script>
7
+ <link href='./assets/0.7.1/application.css' media='screen, projection, print' rel='stylesheet' type='text/css'>
8
+ <link rel="shortcut icon" type="image/png" href="./assets/0.7.1/favicon_green.png" />
9
+ <link rel="icon" type="image/png" href="./assets/0.7.1/favicon.png" />
10
+ </head>
11
+
12
+ <body>
13
+ <div id="loading">
14
+ <img src="./assets/0.7.1/loading.gif" alt="loading"/>
15
+ </div>
16
+ <div id="wrapper" style="display:none;">
17
+ <div class="timestamp">Generated <abbr class="timeago" title="2013-03-30T01:48:05+01:00">2013-03-30T01:48:05+01:00</abbr></div>
18
+ <ul class="group_tabs"></ul>
19
+
20
+ <div id="content">
21
+ <div class="file_list_container" id="AllFiles">
22
+ <h2>
23
+ <span class="group_name">All Files</span>
24
+ (<span class="covered_percent"><span class="green">100.0%</span></span>
25
+ covered at
26
+ <span class="covered_strength">
27
+ <span class="green">
28
+ 45.34
29
+ </span>
30
+ </span> hits/line)
31
+ </h2>
32
+ <a name="AllFiles"></a>
33
+ <div>
34
+ <b>7</b> files in total.
35
+ <b>115</b> relevant lines.
36
+ <span class="green"><b>115</b> lines covered</span> and
37
+ <span class="red"><b>0</b> lines missed </span>
38
+ </div>
39
+ <table class="file_list">
40
+ <thead>
41
+ <tr>
42
+ <th>File</th>
43
+ <th>% covered</th>
44
+ <th>Lines</th>
45
+ <th>Relevant Lines</th>
46
+ <th>Lines covered</th>
47
+ <th>Lines missed</th>
48
+ <th>Avg. Hits / Line</th>
49
+ </tr>
50
+ </thead>
51
+ <tbody>
52
+
53
+ <tr>
54
+ <td class="strong"><a href="#3eb50c8871134c0eb239d05a74a2c349bacd014c" class="src_link" title="lib/blackbox/crypto.rb">lib/blackbox/crypto.rb</a></td>
55
+ <td class="green strong">100.0 %</td>
56
+ <td>99</td>
57
+ <td>32</td>
58
+ <td>32</td>
59
+ <td>0</td>
60
+ <td>236.6</td>
61
+ </tr>
62
+
63
+ <tr>
64
+ <td class="strong"><a href="#0f28219d887f431000ca3154b089891bcf6218e3" class="src_link" title="lib/blackbox/hash.rb">lib/blackbox/hash.rb</a></td>
65
+ <td class="green strong">100.0 %</td>
66
+ <td>49</td>
67
+ <td>13</td>
68
+ <td>13</td>
69
+ <td>0</td>
70
+ <td>7.5</td>
71
+ </tr>
72
+
73
+ <tr>
74
+ <td class="strong"><a href="#b75f047c409859a12a41002ece7dbd0d81dd859d" class="src_link" title="lib/blackbox/string.rb">lib/blackbox/string.rb</a></td>
75
+ <td class="green strong">100.0 %</td>
76
+ <td>17</td>
77
+ <td>5</td>
78
+ <td>5</td>
79
+ <td>0</td>
80
+ <td>1.0</td>
81
+ </tr>
82
+
83
+ <tr>
84
+ <td class="strong"><a href="#b4c16bd67a1a4fce8b02ba44abacd0ec0257943d" class="src_link" title="lib/blackbox/version.rb">lib/blackbox/version.rb</a></td>
85
+ <td class="green strong">100.0 %</td>
86
+ <td>3</td>
87
+ <td>2</td>
88
+ <td>2</td>
89
+ <td>0</td>
90
+ <td>1.0</td>
91
+ </tr>
92
+
93
+ <tr>
94
+ <td class="strong"><a href="#f22e54c644ee98f4bae1e03f860b6a6d7765aa2a" class="src_link" title="spec/crypto_spec.rb">spec/crypto_spec.rb</a></td>
95
+ <td class="green strong">100.0 %</td>
96
+ <td>70</td>
97
+ <td>38</td>
98
+ <td>38</td>
99
+ <td>0</td>
100
+ <td>69.3</td>
101
+ </tr>
102
+
103
+ <tr>
104
+ <td class="strong"><a href="#76591dc79921e23b5067ff22c00caff4f35ddc25" class="src_link" title="spec/hash_spec.rb">spec/hash_spec.rb</a></td>
105
+ <td class="green strong">100.0 %</td>
106
+ <td>51</td>
107
+ <td>17</td>
108
+ <td>17</td>
109
+ <td>0</td>
110
+ <td>1.0</td>
111
+ </tr>
112
+
113
+ <tr>
114
+ <td class="strong"><a href="#f0f2a0640dc412383156f37da73a9a143a48fe1b" class="src_link" title="spec/string_spec.rb">spec/string_spec.rb</a></td>
115
+ <td class="green strong">100.0 %</td>
116
+ <td>13</td>
117
+ <td>8</td>
118
+ <td>8</td>
119
+ <td>0</td>
120
+ <td>1.0</td>
121
+ </tr>
122
+
123
+ </tbody>
124
+ </table>
125
+ </div>
126
+
127
+
128
+
129
+ </div>
130
+
131
+ <div id="footer">
132
+ Generated by <a href="http://github.com/colszowka/simplecov">simplecov</a> v0.7.1
133
+ and simplecov-html v0.7.1<br/>
134
+ using RSpec
135
+ </div>
136
+
137
+ <div class="source_files">
138
+
139
+ <div class="source_table" id="3eb50c8871134c0eb239d05a74a2c349bacd014c">
140
+ <div class="header">
141
+ <h3>lib/blackbox/crypto.rb</h3>
142
+ <h4><span class="green">100.0 %</span> covered</h4>
143
+ <div>
144
+ <b>32</b> relevant lines.
145
+ <span class="green"><b>32</b> lines covered</span> and
146
+ <span class="red"><b>0</b> lines missed.</span>
147
+ </div>
148
+ </div>
149
+
150
+ <pre>
151
+ <ol>
152
+
153
+ <li class="covered" data-hits="1" data-linenumber="1">
154
+ <span class="hits">1</span>
155
+
156
+ <code class="ruby">require &#39;openssl&#39;</code>
157
+ </li>
158
+
159
+ <li class="covered" data-hits="1" data-linenumber="2">
160
+ <span class="hits">1</span>
161
+
162
+ <code class="ruby">require &#39;base64&#39;</code>
163
+ </li>
164
+
165
+ <li class="never" data-hits="" data-linenumber="3">
166
+
167
+
168
+ <code class="ruby"></code>
169
+ </li>
170
+
171
+ <li class="covered" data-hits="1" data-linenumber="4">
172
+ <span class="hits">1</span>
173
+
174
+ <code class="ruby">module BB</code>
175
+ </li>
176
+
177
+ <li class="never" data-hits="" data-linenumber="5">
178
+
179
+
180
+ <code class="ruby"> # Crypto utilities.</code>
181
+ </li>
182
+
183
+ <li class="covered" data-hits="1" data-linenumber="6">
184
+ <span class="hits">1</span>
185
+
186
+ <code class="ruby"> module Crypto</code>
187
+ </li>
188
+
189
+ <li class="covered" data-hits="1" data-linenumber="7">
190
+ <span class="hits">1</span>
191
+
192
+ <code class="ruby"> class &lt;&lt; self </code>
193
+ </li>
194
+
195
+ <li class="never" data-hits="" data-linenumber="8">
196
+
197
+
198
+ <code class="ruby"> # Encrypt a String.</code>
199
+ </li>
200
+
201
+ <li class="never" data-hits="" data-linenumber="9">
202
+
203
+
204
+ <code class="ruby"> #</code>
205
+ </li>
206
+
207
+ <li class="never" data-hits="" data-linenumber="10">
208
+
209
+
210
+ <code class="ruby"> # @param [String] plaintext Input String (plaintext)</code>
211
+ </li>
212
+
213
+ <li class="never" data-hits="" data-linenumber="11">
214
+
215
+
216
+ <code class="ruby"> # @param [String] key Encryption key</code>
217
+ </li>
218
+
219
+ <li class="never" data-hits="" data-linenumber="12">
220
+
221
+
222
+ <code class="ruby"> # @param [String] cipher_type OpenSSL cipher</code>
223
+ </li>
224
+
225
+ <li class="never" data-hits="" data-linenumber="13">
226
+
227
+
228
+ <code class="ruby"> # @param [String] iv Initialization vector</code>
229
+ </li>
230
+
231
+ <li class="never" data-hits="" data-linenumber="14">
232
+
233
+
234
+ <code class="ruby"> # @return [String] When iv == nil: iv_length+iv+ciphertext</code>
235
+ </li>
236
+
237
+ <li class="never" data-hits="" data-linenumber="15">
238
+
239
+
240
+ <code class="ruby"> # @return [String] When iv != nil: ciphertext</code>
241
+ </li>
242
+
243
+ <li class="covered" data-hits="1" data-linenumber="16">
244
+ <span class="hits">1</span>
245
+
246
+ <code class="ruby"> def encrypt(plaintext, key, cipher_type=&#39;aes-256-cbc&#39;, iv=nil) </code>
247
+ </li>
248
+
249
+ <li class="covered" data-hits="697" data-linenumber="17">
250
+ <span class="hits">697</span>
251
+
252
+ <code class="ruby"> aes = OpenSSL::Cipher::Cipher.new(cipher_type) </code>
253
+ </li>
254
+
255
+ <li class="covered" data-hits="697" data-linenumber="18">
256
+ <span class="hits">697</span>
257
+
258
+ <code class="ruby"> aes.encrypt </code>
259
+ </li>
260
+
261
+ <li class="covered" data-hits="697" data-linenumber="19">
262
+ <span class="hits">697</span>
263
+
264
+ <code class="ruby"> aes.key = key </code>
265
+ </li>
266
+
267
+ <li class="covered" data-hits="697" data-linenumber="20">
268
+ <span class="hits">697</span>
269
+
270
+ <code class="ruby"> if iv.nil?</code>
271
+ </li>
272
+
273
+ <li class="covered" data-hits="328" data-linenumber="21">
274
+ <span class="hits">328</span>
275
+
276
+ <code class="ruby"> iv = aes.random_iv</code>
277
+ </li>
278
+
279
+ <li class="covered" data-hits="328" data-linenumber="22">
280
+ <span class="hits">328</span>
281
+
282
+ <code class="ruby"> [iv.length].pack(&#39;C&#39;) + iv + aes.update(plaintext) + aes.final</code>
283
+ </li>
284
+
285
+ <li class="never" data-hits="" data-linenumber="23">
286
+
287
+
288
+ <code class="ruby"> else</code>
289
+ </li>
290
+
291
+ <li class="covered" data-hits="369" data-linenumber="24">
292
+ <span class="hits">369</span>
293
+
294
+ <code class="ruby"> aes.iv = iv</code>
295
+ </li>
296
+
297
+ <li class="covered" data-hits="369" data-linenumber="25">
298
+ <span class="hits">369</span>
299
+
300
+ <code class="ruby"> aes.update(plaintext) + aes.final</code>
301
+ </li>
302
+
303
+ <li class="never" data-hits="" data-linenumber="26">
304
+
305
+
306
+ <code class="ruby"> end</code>
307
+ </li>
308
+
309
+ <li class="never" data-hits="" data-linenumber="27">
310
+
311
+
312
+ <code class="ruby"> end </code>
313
+ </li>
314
+
315
+ <li class="never" data-hits="" data-linenumber="28">
316
+
317
+
318
+ <code class="ruby"></code>
319
+ </li>
320
+
321
+ <li class="never" data-hits="" data-linenumber="29">
322
+
323
+
324
+ <code class="ruby"> # Decrypt a String.</code>
325
+ </li>
326
+
327
+ <li class="never" data-hits="" data-linenumber="30">
328
+
329
+
330
+ <code class="ruby"> #</code>
331
+ </li>
332
+
333
+ <li class="never" data-hits="" data-linenumber="31">
334
+
335
+
336
+ <code class="ruby"> # @param [String] ciphertext Input String (ciphertext)</code>
337
+ </li>
338
+
339
+ <li class="never" data-hits="" data-linenumber="32">
340
+
341
+
342
+ <code class="ruby"> # @param [String] key Encryption key</code>
343
+ </li>
344
+
345
+ <li class="never" data-hits="" data-linenumber="33">
346
+
347
+
348
+ <code class="ruby"> # @param [String] cipher_type OpenSSL cipher</code>
349
+ </li>
350
+
351
+ <li class="never" data-hits="" data-linenumber="34">
352
+
353
+
354
+ <code class="ruby"> # @param [String] iv Initialization vector</code>
355
+ </li>
356
+
357
+ <li class="never" data-hits="" data-linenumber="35">
358
+
359
+
360
+ <code class="ruby"> # @return [String] Plaintext</code>
361
+ </li>
362
+
363
+ <li class="covered" data-hits="1" data-linenumber="36">
364
+ <span class="hits">1</span>
365
+
366
+ <code class="ruby"> def decrypt(ciphertext, key, cipher_type=&#39;aes-256-cbc&#39;, iv=nil) </code>
367
+ </li>
368
+
369
+ <li class="covered" data-hits="369" data-linenumber="37">
370
+ <span class="hits">369</span>
371
+
372
+ <code class="ruby"> aes = OpenSSL::Cipher::Cipher.new(cipher_type) </code>
373
+ </li>
374
+
375
+ <li class="covered" data-hits="369" data-linenumber="38">
376
+ <span class="hits">369</span>
377
+
378
+ <code class="ruby"> aes.decrypt </code>
379
+ </li>
380
+
381
+ <li class="covered" data-hits="369" data-linenumber="39">
382
+ <span class="hits">369</span>
383
+
384
+ <code class="ruby"> aes.key = key </code>
385
+ </li>
386
+
387
+ <li class="covered" data-hits="369" data-linenumber="40">
388
+ <span class="hits">369</span>
389
+
390
+ <code class="ruby"> if iv.nil?</code>
391
+ </li>
392
+
393
+ <li class="covered" data-hits="246" data-linenumber="41">
394
+ <span class="hits">246</span>
395
+
396
+ <code class="ruby"> iv_len = ciphertext.slice!(0).unpack(&#39;C&#39;)[0]</code>
397
+ </li>
398
+
399
+ <li class="covered" data-hits="246" data-linenumber="42">
400
+ <span class="hits">246</span>
401
+
402
+ <code class="ruby"> unless 0 == iv_len</code>
403
+ </li>
404
+
405
+ <li class="covered" data-hits="180" data-linenumber="43">
406
+ <span class="hits">180</span>
407
+
408
+ <code class="ruby"> aes.iv = ciphertext.slice!(0..iv_len-1)</code>
409
+ </li>
410
+
411
+ <li class="never" data-hits="" data-linenumber="44">
412
+
413
+
414
+ <code class="ruby"> end</code>
415
+ </li>
416
+
417
+ <li class="never" data-hits="" data-linenumber="45">
418
+
419
+
420
+ <code class="ruby"> else</code>
421
+ </li>
422
+
423
+ <li class="covered" data-hits="123" data-linenumber="46">
424
+ <span class="hits">123</span>
425
+
426
+ <code class="ruby"> aes.iv = iv</code>
427
+ </li>
428
+
429
+ <li class="never" data-hits="" data-linenumber="47">
430
+
431
+
432
+ <code class="ruby"> end</code>
433
+ </li>
434
+
435
+ <li class="covered" data-hits="369" data-linenumber="48">
436
+ <span class="hits">369</span>
437
+
438
+ <code class="ruby"> aes.update(ciphertext) + aes.final</code>
439
+ </li>
440
+
441
+ <li class="never" data-hits="" data-linenumber="49">
442
+
443
+
444
+ <code class="ruby"> end </code>
445
+ </li>
446
+
447
+ <li class="never" data-hits="" data-linenumber="50">
448
+
449
+
450
+ <code class="ruby"> </code>
451
+ </li>
452
+
453
+ <li class="never" data-hits="" data-linenumber="51">
454
+
455
+
456
+ <code class="ruby"> # Encrypt a String and encode the resulting ciphertext to Base64.</code>
457
+ </li>
458
+
459
+ <li class="never" data-hits="" data-linenumber="52">
460
+
461
+
462
+ <code class="ruby"> #</code>
463
+ </li>
464
+
465
+ <li class="never" data-hits="" data-linenumber="53">
466
+
467
+
468
+ <code class="ruby"> # @param [String] plaintext Input String (plaintext)</code>
469
+ </li>
470
+
471
+ <li class="never" data-hits="" data-linenumber="54">
472
+
473
+
474
+ <code class="ruby"> # @param [String] key Encryption key</code>
475
+ </li>
476
+
477
+ <li class="never" data-hits="" data-linenumber="55">
478
+
479
+
480
+ <code class="ruby"> # @param [String] cipher_type OpenSSL cipher</code>
481
+ </li>
482
+
483
+ <li class="never" data-hits="" data-linenumber="56">
484
+
485
+
486
+ <code class="ruby"> # @param [String] iv Initialization vector</code>
487
+ </li>
488
+
489
+ <li class="never" data-hits="" data-linenumber="57">
490
+
491
+
492
+ <code class="ruby"> # @return [String] When iv == nil: base64(iv_length+iv+ciphertext)</code>
493
+ </li>
494
+
495
+ <li class="never" data-hits="" data-linenumber="58">
496
+
497
+
498
+ <code class="ruby"> # @return [String] When iv != nil: base64(ciphertext)</code>
499
+ </li>
500
+
501
+ <li class="covered" data-hits="1" data-linenumber="59">
502
+ <span class="hits">1</span>
503
+
504
+ <code class="ruby"> def encrypt_base64(plaintext, key, cipher_type=&#39;aes-256-cbc&#39;, iv=nil) </code>
505
+ </li>
506
+
507
+ <li class="covered" data-hits="246" data-linenumber="60">
508
+ <span class="hits">246</span>
509
+
510
+ <code class="ruby"> Base64.strict_encode64(encrypt(plaintext, key, cipher_type, iv))</code>
511
+ </li>
512
+
513
+ <li class="never" data-hits="" data-linenumber="61">
514
+
515
+
516
+ <code class="ruby"> end</code>
517
+ </li>
518
+
519
+ <li class="never" data-hits="" data-linenumber="62">
520
+
521
+
522
+ <code class="ruby"></code>
523
+ </li>
524
+
525
+ <li class="never" data-hits="" data-linenumber="63">
526
+
527
+
528
+ <code class="ruby"> # Decode and Decrypt a Base64-String.</code>
529
+ </li>
530
+
531
+ <li class="never" data-hits="" data-linenumber="64">
532
+
533
+
534
+ <code class="ruby"> #</code>
535
+ </li>
536
+
537
+ <li class="never" data-hits="" data-linenumber="65">
538
+
539
+
540
+ <code class="ruby"> # @param [String] ciphertext Input String (base64(ciphertext))</code>
541
+ </li>
542
+
543
+ <li class="never" data-hits="" data-linenumber="66">
544
+
545
+
546
+ <code class="ruby"> # @param [String] key Encryption key</code>
547
+ </li>
548
+
549
+ <li class="never" data-hits="" data-linenumber="67">
550
+
551
+
552
+ <code class="ruby"> # @param [String] cipher_type OpenSSL cipher</code>
553
+ </li>
554
+
555
+ <li class="never" data-hits="" data-linenumber="68">
556
+
557
+
558
+ <code class="ruby"> # @param [String] iv Initialization vector</code>
559
+ </li>
560
+
561
+ <li class="never" data-hits="" data-linenumber="69">
562
+
563
+
564
+ <code class="ruby"> # @return [String] Plaintext</code>
565
+ </li>
566
+
567
+ <li class="covered" data-hits="1" data-linenumber="70">
568
+ <span class="hits">1</span>
569
+
570
+ <code class="ruby"> def decrypt_base64(ciphertext, key, cipher_type=&#39;aes-256-cbc&#39;, iv=nil) </code>
571
+ </li>
572
+
573
+ <li class="covered" data-hits="123" data-linenumber="71">
574
+ <span class="hits">123</span>
575
+
576
+ <code class="ruby"> decrypt(Base64.decode64(ciphertext), key, cipher_type, iv)</code>
577
+ </li>
578
+
579
+ <li class="never" data-hits="" data-linenumber="72">
580
+
581
+
582
+ <code class="ruby"> end</code>
583
+ </li>
584
+
585
+ <li class="never" data-hits="" data-linenumber="73">
586
+
587
+
588
+ <code class="ruby"></code>
589
+ </li>
590
+
591
+ <li class="never" data-hits="" data-linenumber="74">
592
+
593
+
594
+ <code class="ruby"> # Encrypt a String and encode the resulting ciphertext to urlsafe Base64.</code>
595
+ </li>
596
+
597
+ <li class="never" data-hits="" data-linenumber="75">
598
+
599
+
600
+ <code class="ruby"> #</code>
601
+ </li>
602
+
603
+ <li class="never" data-hits="" data-linenumber="76">
604
+
605
+
606
+ <code class="ruby"> # @param [String] plaintext Input String (plaintext)</code>
607
+ </li>
608
+
609
+ <li class="never" data-hits="" data-linenumber="77">
610
+
611
+
612
+ <code class="ruby"> # @param [String] key Encryption key</code>
613
+ </li>
614
+
615
+ <li class="never" data-hits="" data-linenumber="78">
616
+
617
+
618
+ <code class="ruby"> # @param [String] cipher_type OpenSSL cipher</code>
619
+ </li>
620
+
621
+ <li class="never" data-hits="" data-linenumber="79">
622
+
623
+
624
+ <code class="ruby"> # @param [String] iv Initialization vector</code>
625
+ </li>
626
+
627
+ <li class="never" data-hits="" data-linenumber="80">
628
+
629
+
630
+ <code class="ruby"> # @return [String] When iv == nil: urlsafe_base64(iv_length+iv+ciphertext)</code>
631
+ </li>
632
+
633
+ <li class="never" data-hits="" data-linenumber="81">
634
+
635
+
636
+ <code class="ruby"> # @return [String] When iv != nil: urlsafe_base64(ciphertext)</code>
637
+ </li>
638
+
639
+ <li class="covered" data-hits="1" data-linenumber="82">
640
+ <span class="hits">1</span>
641
+
642
+ <code class="ruby"> def encrypt_urlsafe_base64(plaintext, key, cipher_type=&#39;aes-256-cbc&#39;, iv=nil) </code>
643
+ </li>
644
+
645
+ <li class="covered" data-hits="246" data-linenumber="83">
646
+ <span class="hits">246</span>
647
+
648
+ <code class="ruby"> Base64.urlsafe_encode64(encrypt(plaintext, key, cipher_type, iv))</code>
649
+ </li>
650
+
651
+ <li class="never" data-hits="" data-linenumber="84">
652
+
653
+
654
+ <code class="ruby"> end</code>
655
+ </li>
656
+
657
+ <li class="never" data-hits="" data-linenumber="85">
658
+
659
+
660
+ <code class="ruby"></code>
661
+ </li>
662
+
663
+ <li class="never" data-hits="" data-linenumber="86">
664
+
665
+
666
+ <code class="ruby"> # Decode and Decrypt an urlsafe Base64-String.</code>
667
+ </li>
668
+
669
+ <li class="never" data-hits="" data-linenumber="87">
670
+
671
+
672
+ <code class="ruby"> #</code>
673
+ </li>
674
+
675
+ <li class="never" data-hits="" data-linenumber="88">
676
+
677
+
678
+ <code class="ruby"> # @param [String] ciphertext Input String (urlsafe_base64(ciphertext))</code>
679
+ </li>
680
+
681
+ <li class="never" data-hits="" data-linenumber="89">
682
+
683
+
684
+ <code class="ruby"> # @param [String] key Encryption key</code>
685
+ </li>
686
+
687
+ <li class="never" data-hits="" data-linenumber="90">
688
+
689
+
690
+ <code class="ruby"> # @param [String] cipher_type OpenSSL cipher</code>
691
+ </li>
692
+
693
+ <li class="never" data-hits="" data-linenumber="91">
694
+
695
+
696
+ <code class="ruby"> # @param [String] iv Initialization vector</code>
697
+ </li>
698
+
699
+ <li class="never" data-hits="" data-linenumber="92">
700
+
701
+
702
+ <code class="ruby"> # @return [String] Plaintext</code>
703
+ </li>
704
+
705
+ <li class="covered" data-hits="1" data-linenumber="93">
706
+ <span class="hits">1</span>
707
+
708
+ <code class="ruby"> def decrypt_urlsafe_base64(ciphertext, key, cipher_type=&#39;aes-256-cbc&#39;, iv=nil) </code>
709
+ </li>
710
+
711
+ <li class="covered" data-hits="123" data-linenumber="94">
712
+ <span class="hits">123</span>
713
+
714
+ <code class="ruby"> decrypt(Base64.urlsafe_decode64(ciphertext), key, cipher_type, iv)</code>
715
+ </li>
716
+
717
+ <li class="never" data-hits="" data-linenumber="95">
718
+
719
+
720
+ <code class="ruby"> end</code>
721
+ </li>
722
+
723
+ <li class="never" data-hits="" data-linenumber="96">
724
+
725
+
726
+ <code class="ruby"> end </code>
727
+ </li>
728
+
729
+ <li class="never" data-hits="" data-linenumber="97">
730
+
731
+
732
+ <code class="ruby"> end</code>
733
+ </li>
734
+
735
+ <li class="never" data-hits="" data-linenumber="98">
736
+
737
+
738
+ <code class="ruby">end</code>
739
+ </li>
740
+
741
+ <li class="never" data-hits="" data-linenumber="99">
742
+
743
+
744
+ <code class="ruby"></code>
745
+ </li>
746
+
747
+ </ol>
748
+ </pre>
749
+ </div>
750
+
751
+ <div class="source_table" id="0f28219d887f431000ca3154b089891bcf6218e3">
752
+ <div class="header">
753
+ <h3>lib/blackbox/hash.rb</h3>
754
+ <h4><span class="green">100.0 %</span> covered</h4>
755
+ <div>
756
+ <b>13</b> relevant lines.
757
+ <span class="green"><b>13</b> lines covered</span> and
758
+ <span class="red"><b>0</b> lines missed.</span>
759
+ </div>
760
+ </div>
761
+
762
+ <pre>
763
+ <ol>
764
+
765
+ <li class="covered" data-hits="1" data-linenumber="1">
766
+ <span class="hits">1</span>
767
+
768
+ <code class="ruby">module BB</code>
769
+ </li>
770
+
771
+ <li class="never" data-hits="" data-linenumber="2">
772
+
773
+
774
+ <code class="ruby"> # Hash utilities.</code>
775
+ </li>
776
+
777
+ <li class="covered" data-hits="1" data-linenumber="3">
778
+ <span class="hits">1</span>
779
+
780
+ <code class="ruby"> module Hash</code>
781
+ </li>
782
+
783
+ <li class="covered" data-hits="1" data-linenumber="4">
784
+ <span class="hits">1</span>
785
+
786
+ <code class="ruby"> class &lt;&lt; self </code>
787
+ </li>
788
+
789
+ <li class="never" data-hits="" data-linenumber="5">
790
+
791
+
792
+ <code class="ruby"> # Symbolize all top level keys.</code>
793
+ </li>
794
+
795
+ <li class="never" data-hits="" data-linenumber="6">
796
+
797
+
798
+ <code class="ruby"> #</code>
799
+ </li>
800
+
801
+ <li class="never" data-hits="" data-linenumber="7">
802
+
803
+
804
+ <code class="ruby"> # @param [Hash] hash Input hash</code>
805
+ </li>
806
+
807
+ <li class="never" data-hits="" data-linenumber="8">
808
+
809
+
810
+ <code class="ruby"> # @return [Hash] Output hash (with symbolized keys)</code>
811
+ </li>
812
+
813
+ <li class="covered" data-hits="1" data-linenumber="9">
814
+ <span class="hits">1</span>
815
+
816
+ <code class="ruby"> def symbolize_keys(hash)</code>
817
+ </li>
818
+
819
+ <li class="covered" data-hits="7" data-linenumber="10">
820
+ <span class="hits">7</span>
821
+
822
+ <code class="ruby"> hash.each_with_object({}){|(k,v), h| h[k.to_sym] = v}</code>
823
+ </li>
824
+
825
+ <li class="never" data-hits="" data-linenumber="11">
826
+
827
+
828
+ <code class="ruby"> end</code>
829
+ </li>
830
+
831
+ <li class="never" data-hits="" data-linenumber="12">
832
+
833
+
834
+ <code class="ruby"></code>
835
+ </li>
836
+
837
+ <li class="never" data-hits="" data-linenumber="13">
838
+
839
+
840
+ <code class="ruby"> # Recursively flatten a hash to property-style format.</code>
841
+ </li>
842
+
843
+ <li class="never" data-hits="" data-linenumber="14">
844
+
845
+
846
+ <code class="ruby"> # This is a lossy conversion and should only be used for display-purposes.</code>
847
+ </li>
848
+
849
+ <li class="never" data-hits="" data-linenumber="15">
850
+
851
+
852
+ <code class="ruby"> #</code>
853
+ </li>
854
+
855
+ <li class="never" data-hits="" data-linenumber="16">
856
+
857
+
858
+ <code class="ruby"> # @example</code>
859
+ </li>
860
+
861
+ <li class="never" data-hits="" data-linenumber="17">
862
+
863
+
864
+ <code class="ruby"> # input = { :a =&gt; { :b =&gt; :c } }</code>
865
+ </li>
866
+
867
+ <li class="never" data-hits="" data-linenumber="18">
868
+
869
+
870
+ <code class="ruby"> # BB::Hash.flatten_prop_style(input)</code>
871
+ </li>
872
+
873
+ <li class="never" data-hits="" data-linenumber="19">
874
+
875
+
876
+ <code class="ruby"> # =&gt; {&quot;a.b&quot;=&gt;:c}</code>
877
+ </li>
878
+
879
+ <li class="never" data-hits="" data-linenumber="20">
880
+
881
+
882
+ <code class="ruby"> #</code>
883
+ </li>
884
+
885
+ <li class="never" data-hits="" data-linenumber="21">
886
+
887
+
888
+ <code class="ruby"> # @example</code>
889
+ </li>
890
+
891
+ <li class="never" data-hits="" data-linenumber="22">
892
+
893
+
894
+ <code class="ruby"> # input = { :a =&gt; { :b =&gt; [:c, :d, :e] } }</code>
895
+ </li>
896
+
897
+ <li class="never" data-hits="" data-linenumber="23">
898
+
899
+
900
+ <code class="ruby"> # BB::Hash.flatten_prop_style(input)</code>
901
+ </li>
902
+
903
+ <li class="never" data-hits="" data-linenumber="24">
904
+
905
+
906
+ <code class="ruby"> # =&gt; {&quot;a.b&quot;=&gt;&quot;c,d,e&quot;}</code>
907
+ </li>
908
+
909
+ <li class="never" data-hits="" data-linenumber="25">
910
+
911
+
912
+ <code class="ruby"> #</code>
913
+ </li>
914
+
915
+ <li class="never" data-hits="" data-linenumber="26">
916
+
917
+
918
+ <code class="ruby"> # @param [Hash] input Input hash</code>
919
+ </li>
920
+
921
+ <li class="never" data-hits="" data-linenumber="27">
922
+
923
+
924
+ <code class="ruby"> # @param [Hash] opts Options</code>
925
+ </li>
926
+
927
+ <li class="never" data-hits="" data-linenumber="28">
928
+
929
+
930
+ <code class="ruby"> # @option opts [String] :delimiter</code>
931
+ </li>
932
+
933
+ <li class="never" data-hits="" data-linenumber="29">
934
+
935
+
936
+ <code class="ruby"> # Key delimiter (Default: &#39;.&#39;)</code>
937
+ </li>
938
+
939
+ <li class="never" data-hits="" data-linenumber="30">
940
+
941
+
942
+ <code class="ruby"> # @param [Hash] output (leave this blank)</code>
943
+ </li>
944
+
945
+ <li class="never" data-hits="" data-linenumber="31">
946
+
947
+
948
+ <code class="ruby"> # @return [Hash] Output hash (flattened)</code>
949
+ </li>
950
+
951
+ <li class="covered" data-hits="1" data-linenumber="32">
952
+ <span class="hits">1</span>
953
+
954
+ <code class="ruby"> def flatten_prop_style(input={}, opts={}, output={})</code>
955
+ </li>
956
+
957
+ <li class="covered" data-hits="10" data-linenumber="33">
958
+ <span class="hits">10</span>
959
+
960
+ <code class="ruby"> input.each do |key, value|</code>
961
+ </li>
962
+
963
+ <li class="covered" data-hits="22" data-linenumber="34">
964
+ <span class="hits">22</span>
965
+
966
+ <code class="ruby"> key = opts[:prefix].nil? ? &quot;#{key}&quot; : &quot;#{opts[:prefix]}#{opts[:delimiter]||&quot;.&quot;}#{key}&quot;</code>
967
+ </li>
968
+
969
+ <li class="covered" data-hits="22" data-linenumber="35">
970
+ <span class="hits">22</span>
971
+
972
+ <code class="ruby"> case value</code>
973
+ </li>
974
+
975
+ <li class="never" data-hits="" data-linenumber="36">
976
+
977
+
978
+ <code class="ruby"> when ::Hash</code>
979
+ </li>
980
+
981
+ <li class="covered" data-hits="9" data-linenumber="37">
982
+ <span class="hits">9</span>
983
+
984
+ <code class="ruby"> flatten_prop_style(value, {:prefix =&gt; key, :delimiter =&gt; &quot;.&quot;}, output)</code>
985
+ </li>
986
+
987
+ <li class="never" data-hits="" data-linenumber="38">
988
+
989
+
990
+ <code class="ruby"> when Array</code>
991
+ </li>
992
+
993
+ <li class="covered" data-hits="4" data-linenumber="39">
994
+ <span class="hits">4</span>
995
+
996
+ <code class="ruby"> output[key] = value.join(&#39;,&#39;)</code>
997
+ </li>
998
+
999
+ <li class="never" data-hits="" data-linenumber="40">
1000
+
1001
+
1002
+ <code class="ruby"> else</code>
1003
+ </li>
1004
+
1005
+ <li class="covered" data-hits="9" data-linenumber="41">
1006
+ <span class="hits">9</span>
1007
+
1008
+ <code class="ruby"> output[key] = value</code>
1009
+ </li>
1010
+
1011
+ <li class="never" data-hits="" data-linenumber="42">
1012
+
1013
+
1014
+ <code class="ruby"> end</code>
1015
+ </li>
1016
+
1017
+ <li class="never" data-hits="" data-linenumber="43">
1018
+
1019
+
1020
+ <code class="ruby"> end</code>
1021
+ </li>
1022
+
1023
+ <li class="covered" data-hits="10" data-linenumber="44">
1024
+ <span class="hits">10</span>
1025
+
1026
+ <code class="ruby"> output</code>
1027
+ </li>
1028
+
1029
+ <li class="never" data-hits="" data-linenumber="45">
1030
+
1031
+
1032
+ <code class="ruby"> end</code>
1033
+ </li>
1034
+
1035
+ <li class="never" data-hits="" data-linenumber="46">
1036
+
1037
+
1038
+ <code class="ruby"> end</code>
1039
+ </li>
1040
+
1041
+ <li class="never" data-hits="" data-linenumber="47">
1042
+
1043
+
1044
+ <code class="ruby"> end</code>
1045
+ </li>
1046
+
1047
+ <li class="never" data-hits="" data-linenumber="48">
1048
+
1049
+
1050
+ <code class="ruby">end</code>
1051
+ </li>
1052
+
1053
+ <li class="never" data-hits="" data-linenumber="49">
1054
+
1055
+
1056
+ <code class="ruby"></code>
1057
+ </li>
1058
+
1059
+ </ol>
1060
+ </pre>
1061
+ </div>
1062
+
1063
+ <div class="source_table" id="b75f047c409859a12a41002ece7dbd0d81dd859d">
1064
+ <div class="header">
1065
+ <h3>lib/blackbox/string.rb</h3>
1066
+ <h4><span class="green">100.0 %</span> covered</h4>
1067
+ <div>
1068
+ <b>5</b> relevant lines.
1069
+ <span class="green"><b>5</b> lines covered</span> and
1070
+ <span class="red"><b>0</b> lines missed.</span>
1071
+ </div>
1072
+ </div>
1073
+
1074
+ <pre>
1075
+ <ol>
1076
+
1077
+ <li class="covered" data-hits="1" data-linenumber="1">
1078
+ <span class="hits">1</span>
1079
+
1080
+ <code class="ruby">module BB</code>
1081
+ </li>
1082
+
1083
+ <li class="never" data-hits="" data-linenumber="2">
1084
+
1085
+
1086
+ <code class="ruby"> # String utilities.</code>
1087
+ </li>
1088
+
1089
+ <li class="covered" data-hits="1" data-linenumber="3">
1090
+ <span class="hits">1</span>
1091
+
1092
+ <code class="ruby"> module String</code>
1093
+ </li>
1094
+
1095
+ <li class="covered" data-hits="1" data-linenumber="4">
1096
+ <span class="hits">1</span>
1097
+
1098
+ <code class="ruby"> class &lt;&lt; self </code>
1099
+ </li>
1100
+
1101
+ <li class="never" data-hits="" data-linenumber="5">
1102
+
1103
+
1104
+ <code class="ruby"> # Strip ANSI escape sequences from String.</code>
1105
+ </li>
1106
+
1107
+ <li class="never" data-hits="" data-linenumber="6">
1108
+
1109
+
1110
+ <code class="ruby"> #</code>
1111
+ </li>
1112
+
1113
+ <li class="never" data-hits="" data-linenumber="7">
1114
+
1115
+
1116
+ <code class="ruby"> # @param [String] text Input string (dirty)</code>
1117
+ </li>
1118
+
1119
+ <li class="never" data-hits="" data-linenumber="8">
1120
+
1121
+
1122
+ <code class="ruby"> # @return [String] Output string (cleaned)</code>
1123
+ </li>
1124
+
1125
+ <li class="covered" data-hits="1" data-linenumber="9">
1126
+ <span class="hits">1</span>
1127
+
1128
+ <code class="ruby"> def strip_ansi(text)</code>
1129
+ </li>
1130
+
1131
+ <li class="never" data-hits="" data-linenumber="10">
1132
+
1133
+
1134
+ <code class="ruby"> text.gsub(/\x1b(\[|\(|\))[;?0-9]*[0-9A-Za-z]/, &#39;&#39;).</code>
1135
+ </li>
1136
+
1137
+ <li class="never" data-hits="" data-linenumber="11">
1138
+
1139
+
1140
+ <code class="ruby"> gsub(/\x1b(\[|\(|\))[;?0-9]*[0-9A-Za-z]/, &#39;&#39;).</code>
1141
+ </li>
1142
+
1143
+ <li class="covered" data-hits="1" data-linenumber="12">
1144
+ <span class="hits">1</span>
1145
+
1146
+ <code class="ruby"> gsub(/(\x03|\x1a)/, &#39;&#39;)</code>
1147
+ </li>
1148
+
1149
+ <li class="never" data-hits="" data-linenumber="13">
1150
+
1151
+
1152
+ <code class="ruby"> end</code>
1153
+ </li>
1154
+
1155
+ <li class="never" data-hits="" data-linenumber="14">
1156
+
1157
+
1158
+ <code class="ruby"> end</code>
1159
+ </li>
1160
+
1161
+ <li class="never" data-hits="" data-linenumber="15">
1162
+
1163
+
1164
+ <code class="ruby"> end</code>
1165
+ </li>
1166
+
1167
+ <li class="never" data-hits="" data-linenumber="16">
1168
+
1169
+
1170
+ <code class="ruby">end</code>
1171
+ </li>
1172
+
1173
+ <li class="never" data-hits="" data-linenumber="17">
1174
+
1175
+
1176
+ <code class="ruby"></code>
1177
+ </li>
1178
+
1179
+ </ol>
1180
+ </pre>
1181
+ </div>
1182
+
1183
+ <div class="source_table" id="b4c16bd67a1a4fce8b02ba44abacd0ec0257943d">
1184
+ <div class="header">
1185
+ <h3>lib/blackbox/version.rb</h3>
1186
+ <h4><span class="green">100.0 %</span> covered</h4>
1187
+ <div>
1188
+ <b>2</b> relevant lines.
1189
+ <span class="green"><b>2</b> lines covered</span> and
1190
+ <span class="red"><b>0</b> lines missed.</span>
1191
+ </div>
1192
+ </div>
1193
+
1194
+ <pre>
1195
+ <ol>
1196
+
1197
+ <li class="covered" data-hits="1" data-linenumber="1">
1198
+ <span class="hits">1</span>
1199
+
1200
+ <code class="ruby">module BB</code>
1201
+ </li>
1202
+
1203
+ <li class="covered" data-hits="1" data-linenumber="2">
1204
+ <span class="hits">1</span>
1205
+
1206
+ <code class="ruby"> VERSION = &quot;1.0.0&quot;</code>
1207
+ </li>
1208
+
1209
+ <li class="never" data-hits="" data-linenumber="3">
1210
+
1211
+
1212
+ <code class="ruby">end</code>
1213
+ </li>
1214
+
1215
+ </ol>
1216
+ </pre>
1217
+ </div>
1218
+
1219
+ <div class="source_table" id="f22e54c644ee98f4bae1e03f860b6a6d7765aa2a">
1220
+ <div class="header">
1221
+ <h3>spec/crypto_spec.rb</h3>
1222
+ <h4><span class="green">100.0 %</span> covered</h4>
1223
+ <div>
1224
+ <b>38</b> relevant lines.
1225
+ <span class="green"><b>38</b> lines covered</span> and
1226
+ <span class="red"><b>0</b> lines missed.</span>
1227
+ </div>
1228
+ </div>
1229
+
1230
+ <pre>
1231
+ <ol>
1232
+
1233
+ <li class="covered" data-hits="1" data-linenumber="1">
1234
+ <span class="hits">1</span>
1235
+
1236
+ <code class="ruby">require &#39;spec_helper&#39;</code>
1237
+ </li>
1238
+
1239
+ <li class="covered" data-hits="1" data-linenumber="2">
1240
+ <span class="hits">1</span>
1241
+
1242
+ <code class="ruby">require &#39;blackbox/crypto&#39;</code>
1243
+ </li>
1244
+
1245
+ <li class="covered" data-hits="1" data-linenumber="3">
1246
+ <span class="hits">1</span>
1247
+
1248
+ <code class="ruby">require &#39;base64&#39;</code>
1249
+ </li>
1250
+
1251
+ <li class="never" data-hits="" data-linenumber="4">
1252
+
1253
+
1254
+ <code class="ruby"></code>
1255
+ </li>
1256
+
1257
+ <li class="covered" data-hits="1" data-linenumber="5">
1258
+ <span class="hits">1</span>
1259
+
1260
+ <code class="ruby">OPENSSL_CIPHERS = %w[aes-128-cbc aes-128-ecb aes-192-cbc aes-192-ecb aes-256-cbc]+</code>
1261
+ </li>
1262
+
1263
+ <li class="never" data-hits="" data-linenumber="6">
1264
+
1265
+
1266
+ <code class="ruby"> %w[aes-256-ecb bf bf-cbc bf-cfb]+</code>
1267
+ </li>
1268
+
1269
+ <li class="never" data-hits="" data-linenumber="7">
1270
+
1271
+
1272
+ <code class="ruby"> %w[bf-ecb bf-ofb cast cast-cbc cast5-cbc]+</code>
1273
+ </li>
1274
+
1275
+ <li class="never" data-hits="" data-linenumber="8">
1276
+
1277
+
1278
+ <code class="ruby"> %w[cast5-cfb cast5-ecb cast5-ofb des des-cbc]+</code>
1279
+ </li>
1280
+
1281
+ <li class="never" data-hits="" data-linenumber="9">
1282
+
1283
+
1284
+ <code class="ruby"> %w[des-cfb des-ecb des-ede des-ede-cbc des-ede-cfb]+</code>
1285
+ </li>
1286
+
1287
+ <li class="never" data-hits="" data-linenumber="10">
1288
+
1289
+
1290
+ <code class="ruby"> %w[des-ede-ofb des-ede3 des-ede3-cbc des-ede3-cfb des-ede3-ofb]+</code>
1291
+ </li>
1292
+
1293
+ <li class="never" data-hits="" data-linenumber="11">
1294
+
1295
+
1296
+ <code class="ruby"> %w[des-ofb des3 desx rc2 rc2-40-cbc]+</code>
1297
+ </li>
1298
+
1299
+ <li class="never" data-hits="" data-linenumber="12">
1300
+
1301
+
1302
+ <code class="ruby"> %w[rc2-64-cbc rc2-cbc rc2-cfb rc2-ecb rc2-ofb]+</code>
1303
+ </li>
1304
+
1305
+ <li class="never" data-hits="" data-linenumber="13">
1306
+
1307
+
1308
+ <code class="ruby"> %w[rc4 rc4-40]</code>
1309
+ </li>
1310
+
1311
+ <li class="never" data-hits="" data-linenumber="14">
1312
+
1313
+
1314
+ <code class="ruby"></code>
1315
+ </li>
1316
+
1317
+ <li class="covered" data-hits="1" data-linenumber="15">
1318
+ <span class="hits">1</span>
1319
+
1320
+ <code class="ruby">TEST_KEY=&#39;12345678901234567890123456789012&#39;</code>
1321
+ </li>
1322
+
1323
+ <li class="covered" data-hits="1" data-linenumber="16">
1324
+ <span class="hits">1</span>
1325
+
1326
+ <code class="ruby">TEST_IV =&#39;x234567890123456789012345678901x&#39;</code>
1327
+ </li>
1328
+
1329
+ <li class="covered" data-hits="1" data-linenumber="17">
1330
+ <span class="hits">1</span>
1331
+
1332
+ <code class="ruby">TEST_TEXT_SHORT=&#39;[SHORT_TEST]&#39;*16</code>
1333
+ </li>
1334
+
1335
+ <li class="covered" data-hits="1" data-linenumber="18">
1336
+ <span class="hits">1</span>
1337
+
1338
+ <code class="ruby">TEST_TEXT_LONG=&#39;[LONG_TEST]&#39;*8192</code>
1339
+ </li>
1340
+
1341
+ <li class="never" data-hits="" data-linenumber="19">
1342
+
1343
+
1344
+ <code class="ruby"></code>
1345
+ </li>
1346
+
1347
+ <li class="covered" data-hits="1" data-linenumber="20">
1348
+ <span class="hits">1</span>
1349
+
1350
+ <code class="ruby">describe BB::Crypto do</code>
1351
+ </li>
1352
+
1353
+ <li class="covered" data-hits="1" data-linenumber="21">
1354
+ <span class="hits">1</span>
1355
+
1356
+ <code class="ruby"> OPENSSL_CIPHERS.each do |cipher|</code>
1357
+ </li>
1358
+
1359
+ <li class="covered" data-hits="41" data-linenumber="22">
1360
+ <span class="hits">41</span>
1361
+
1362
+ <code class="ruby"> describe &quot;#{cipher}&quot; do</code>
1363
+ </li>
1364
+
1365
+ <li class="never" data-hits="" data-linenumber="23">
1366
+
1367
+
1368
+ <code class="ruby"> [[:encrypt, :decrypt],</code>
1369
+ </li>
1370
+
1371
+ <li class="never" data-hits="" data-linenumber="24">
1372
+
1373
+
1374
+ <code class="ruby"> [:encrypt_base64, :decrypt_base64],</code>
1375
+ </li>
1376
+
1377
+ <li class="covered" data-hits="41" data-linenumber="25">
1378
+ <span class="hits">41</span>
1379
+
1380
+ <code class="ruby"> [:encrypt_urlsafe_base64, :decrypt_urlsafe_base64]].each do |e|</code>
1381
+ </li>
1382
+
1383
+ <li class="covered" data-hits="123" data-linenumber="26">
1384
+ <span class="hits">123</span>
1385
+
1386
+ <code class="ruby"> m_enc, m_dec = e</code>
1387
+ </li>
1388
+
1389
+ <li class="covered" data-hits="123" data-linenumber="27">
1390
+ <span class="hits">123</span>
1391
+
1392
+ <code class="ruby"> describe &quot;#{m_enc}, #{m_dec}&quot; do</code>
1393
+ </li>
1394
+
1395
+ <li class="covered" data-hits="123" data-linenumber="28">
1396
+ <span class="hits">123</span>
1397
+
1398
+ <code class="ruby"> it &quot;can decrypt what it encrypted (short string, random iv)&quot; do</code>
1399
+ </li>
1400
+
1401
+ <li class="covered" data-hits="123" data-linenumber="29">
1402
+ <span class="hits">123</span>
1403
+
1404
+ <code class="ruby"> ct = BB::Crypto.send(m_enc, TEST_TEXT_SHORT, TEST_KEY, cipher)</code>
1405
+ </li>
1406
+
1407
+ <li class="covered" data-hits="123" data-linenumber="30">
1408
+ <span class="hits">123</span>
1409
+
1410
+ <code class="ruby"> pt = BB::Crypto.send(m_dec, ct, TEST_KEY, cipher)</code>
1411
+ </li>
1412
+
1413
+ <li class="covered" data-hits="123" data-linenumber="31">
1414
+ <span class="hits">123</span>
1415
+
1416
+ <code class="ruby"> pt.should == TEST_TEXT_SHORT</code>
1417
+ </li>
1418
+
1419
+ <li class="never" data-hits="" data-linenumber="32">
1420
+
1421
+
1422
+ <code class="ruby"> end</code>
1423
+ </li>
1424
+
1425
+ <li class="never" data-hits="" data-linenumber="33">
1426
+
1427
+
1428
+ <code class="ruby"></code>
1429
+ </li>
1430
+
1431
+ <li class="covered" data-hits="123" data-linenumber="34">
1432
+ <span class="hits">123</span>
1433
+
1434
+ <code class="ruby"> it &quot;can decrypt what it encrypted (long string, random iv)&quot; do</code>
1435
+ </li>
1436
+
1437
+ <li class="covered" data-hits="123" data-linenumber="35">
1438
+ <span class="hits">123</span>
1439
+
1440
+ <code class="ruby"> ct = BB::Crypto.send(m_enc, TEST_TEXT_LONG, TEST_KEY, cipher)</code>
1441
+ </li>
1442
+
1443
+ <li class="covered" data-hits="123" data-linenumber="36">
1444
+ <span class="hits">123</span>
1445
+
1446
+ <code class="ruby"> pt = BB::Crypto.send(m_dec, ct, TEST_KEY, cipher)</code>
1447
+ </li>
1448
+
1449
+ <li class="covered" data-hits="123" data-linenumber="37">
1450
+ <span class="hits">123</span>
1451
+
1452
+ <code class="ruby"> pt.should == TEST_TEXT_LONG</code>
1453
+ </li>
1454
+
1455
+ <li class="never" data-hits="" data-linenumber="38">
1456
+
1457
+
1458
+ <code class="ruby"> end</code>
1459
+ </li>
1460
+
1461
+ <li class="never" data-hits="" data-linenumber="39">
1462
+
1463
+
1464
+ <code class="ruby"></code>
1465
+ </li>
1466
+
1467
+ <li class="covered" data-hits="123" data-linenumber="40">
1468
+ <span class="hits">123</span>
1469
+
1470
+ <code class="ruby"> it &quot;can decrypt what it encrypted (long string, static iv)&quot; do</code>
1471
+ </li>
1472
+
1473
+ <li class="covered" data-hits="123" data-linenumber="41">
1474
+ <span class="hits">123</span>
1475
+
1476
+ <code class="ruby"> ct = BB::Crypto.send(m_enc, TEST_TEXT_LONG, TEST_KEY, cipher, TEST_IV)</code>
1477
+ </li>
1478
+
1479
+ <li class="covered" data-hits="123" data-linenumber="42">
1480
+ <span class="hits">123</span>
1481
+
1482
+ <code class="ruby"> pt = BB::Crypto.send(m_dec, ct, TEST_KEY, cipher, TEST_IV)</code>
1483
+ </li>
1484
+
1485
+ <li class="covered" data-hits="123" data-linenumber="43">
1486
+ <span class="hits">123</span>
1487
+
1488
+ <code class="ruby"> pt.should == TEST_TEXT_LONG</code>
1489
+ </li>
1490
+
1491
+ <li class="never" data-hits="" data-linenumber="44">
1492
+
1493
+
1494
+ <code class="ruby"> end</code>
1495
+ </li>
1496
+
1497
+ <li class="never" data-hits="" data-linenumber="45">
1498
+
1499
+
1500
+ <code class="ruby"></code>
1501
+ </li>
1502
+
1503
+ <li class="covered" data-hits="123" data-linenumber="46">
1504
+ <span class="hits">123</span>
1505
+
1506
+ <code class="ruby"> it &quot;returns consistent output with static iv&quot; do</code>
1507
+ </li>
1508
+
1509
+ <li class="covered" data-hits="123" data-linenumber="47">
1510
+ <span class="hits">123</span>
1511
+
1512
+ <code class="ruby"> a = BB::Crypto.send(m_enc, TEST_TEXT_SHORT, TEST_KEY, cipher, TEST_IV)</code>
1513
+ </li>
1514
+
1515
+ <li class="covered" data-hits="123" data-linenumber="48">
1516
+ <span class="hits">123</span>
1517
+
1518
+ <code class="ruby"> b = BB::Crypto.send(m_enc, TEST_TEXT_SHORT, TEST_KEY, cipher, TEST_IV)</code>
1519
+ </li>
1520
+
1521
+ <li class="covered" data-hits="123" data-linenumber="49">
1522
+ <span class="hits">123</span>
1523
+
1524
+ <code class="ruby"> a.should == b</code>
1525
+ </li>
1526
+
1527
+ <li class="never" data-hits="" data-linenumber="50">
1528
+
1529
+
1530
+ <code class="ruby"> end</code>
1531
+ </li>
1532
+
1533
+ <li class="never" data-hits="" data-linenumber="51">
1534
+
1535
+
1536
+ <code class="ruby"> end</code>
1537
+ </li>
1538
+
1539
+ <li class="never" data-hits="" data-linenumber="52">
1540
+
1541
+
1542
+ <code class="ruby"> end</code>
1543
+ </li>
1544
+
1545
+ <li class="never" data-hits="" data-linenumber="53">
1546
+
1547
+
1548
+ <code class="ruby"></code>
1549
+ </li>
1550
+
1551
+ <li class="covered" data-hits="41" data-linenumber="54">
1552
+ <span class="hits">41</span>
1553
+
1554
+ <code class="ruby"> describe &quot;encrypt_base64&quot; do</code>
1555
+ </li>
1556
+
1557
+ <li class="covered" data-hits="41" data-linenumber="55">
1558
+ <span class="hits">41</span>
1559
+
1560
+ <code class="ruby"> it &quot;returns base64 string&quot; do</code>
1561
+ </li>
1562
+
1563
+ <li class="covered" data-hits="41" data-linenumber="56">
1564
+ <span class="hits">41</span>
1565
+
1566
+ <code class="ruby"> ct = BB::Crypto.encrypt_base64(TEST_TEXT_LONG, TEST_KEY)</code>
1567
+ </li>
1568
+
1569
+ <li class="covered" data-hits="41" data-linenumber="57">
1570
+ <span class="hits">41</span>
1571
+
1572
+ <code class="ruby"> Base64.decode64(ct)</code>
1573
+ </li>
1574
+
1575
+ <li class="never" data-hits="" data-linenumber="58">
1576
+
1577
+
1578
+ <code class="ruby"> end</code>
1579
+ </li>
1580
+
1581
+ <li class="never" data-hits="" data-linenumber="59">
1582
+
1583
+
1584
+ <code class="ruby"> end</code>
1585
+ </li>
1586
+
1587
+ <li class="never" data-hits="" data-linenumber="60">
1588
+
1589
+
1590
+ <code class="ruby"></code>
1591
+ </li>
1592
+
1593
+ <li class="covered" data-hits="41" data-linenumber="61">
1594
+ <span class="hits">41</span>
1595
+
1596
+ <code class="ruby"> describe &quot;encrypt_urlsafe_base64&quot; do</code>
1597
+ </li>
1598
+
1599
+ <li class="covered" data-hits="41" data-linenumber="62">
1600
+ <span class="hits">41</span>
1601
+
1602
+ <code class="ruby"> it &quot;returns urlsafe base64 string&quot; do</code>
1603
+ </li>
1604
+
1605
+ <li class="covered" data-hits="41" data-linenumber="63">
1606
+ <span class="hits">41</span>
1607
+
1608
+ <code class="ruby"> ct = BB::Crypto.encrypt_urlsafe_base64(TEST_TEXT_LONG, TEST_KEY)</code>
1609
+ </li>
1610
+
1611
+ <li class="covered" data-hits="41" data-linenumber="64">
1612
+ <span class="hits">41</span>
1613
+
1614
+ <code class="ruby"> Base64.urlsafe_decode64(ct)</code>
1615
+ </li>
1616
+
1617
+ <li class="never" data-hits="" data-linenumber="65">
1618
+
1619
+
1620
+ <code class="ruby"> end</code>
1621
+ </li>
1622
+
1623
+ <li class="never" data-hits="" data-linenumber="66">
1624
+
1625
+
1626
+ <code class="ruby"> end</code>
1627
+ </li>
1628
+
1629
+ <li class="never" data-hits="" data-linenumber="67">
1630
+
1631
+
1632
+ <code class="ruby"> end</code>
1633
+ </li>
1634
+
1635
+ <li class="never" data-hits="" data-linenumber="68">
1636
+
1637
+
1638
+ <code class="ruby"> end</code>
1639
+ </li>
1640
+
1641
+ <li class="never" data-hits="" data-linenumber="69">
1642
+
1643
+
1644
+ <code class="ruby">end</code>
1645
+ </li>
1646
+
1647
+ <li class="never" data-hits="" data-linenumber="70">
1648
+
1649
+
1650
+ <code class="ruby"></code>
1651
+ </li>
1652
+
1653
+ </ol>
1654
+ </pre>
1655
+ </div>
1656
+
1657
+ <div class="source_table" id="76591dc79921e23b5067ff22c00caff4f35ddc25">
1658
+ <div class="header">
1659
+ <h3>spec/hash_spec.rb</h3>
1660
+ <h4><span class="green">100.0 %</span> covered</h4>
1661
+ <div>
1662
+ <b>17</b> relevant lines.
1663
+ <span class="green"><b>17</b> lines covered</span> and
1664
+ <span class="red"><b>0</b> lines missed.</span>
1665
+ </div>
1666
+ </div>
1667
+
1668
+ <pre>
1669
+ <ol>
1670
+
1671
+ <li class="covered" data-hits="1" data-linenumber="1">
1672
+ <span class="hits">1</span>
1673
+
1674
+ <code class="ruby">require &#39;spec_helper&#39;</code>
1675
+ </li>
1676
+
1677
+ <li class="covered" data-hits="1" data-linenumber="2">
1678
+ <span class="hits">1</span>
1679
+
1680
+ <code class="ruby">require &#39;blackbox/hash&#39;</code>
1681
+ </li>
1682
+
1683
+ <li class="never" data-hits="" data-linenumber="3">
1684
+
1685
+
1686
+ <code class="ruby"></code>
1687
+ </li>
1688
+
1689
+ <li class="covered" data-hits="1" data-linenumber="4">
1690
+ <span class="hits">1</span>
1691
+
1692
+ <code class="ruby">describe BB::Hash do</code>
1693
+ </li>
1694
+
1695
+ <li class="covered" data-hits="1" data-linenumber="5">
1696
+ <span class="hits">1</span>
1697
+
1698
+ <code class="ruby"> describe &#39;.symbolize_keys&#39; do</code>
1699
+ </li>
1700
+
1701
+ <li class="covered" data-hits="1" data-linenumber="6">
1702
+ <span class="hits">1</span>
1703
+
1704
+ <code class="ruby"> it &quot;turns all keys into symbols&quot; do</code>
1705
+ </li>
1706
+
1707
+ <li class="covered" data-hits="1" data-linenumber="7">
1708
+ <span class="hits">1</span>
1709
+
1710
+ <code class="ruby"> have = { &#39;foo&#39; =&gt; 1, :bar =&gt; 2, &#39;batz&#39; =&gt; 3 }</code>
1711
+ </li>
1712
+
1713
+ <li class="covered" data-hits="1" data-linenumber="8">
1714
+ <span class="hits">1</span>
1715
+
1716
+ <code class="ruby"> want = { :foo =&gt; 1, :bar =&gt; 2, :batz =&gt; 3 }</code>
1717
+ </li>
1718
+
1719
+ <li class="covered" data-hits="1" data-linenumber="9">
1720
+ <span class="hits">1</span>
1721
+
1722
+ <code class="ruby"> BB::Hash.symbolize_keys(have).should == want</code>
1723
+ </li>
1724
+
1725
+ <li class="never" data-hits="" data-linenumber="10">
1726
+
1727
+
1728
+ <code class="ruby"> end</code>
1729
+ </li>
1730
+
1731
+ <li class="never" data-hits="" data-linenumber="11">
1732
+
1733
+
1734
+ <code class="ruby"></code>
1735
+ </li>
1736
+
1737
+ <li class="covered" data-hits="1" data-linenumber="12">
1738
+ <span class="hits">1</span>
1739
+
1740
+ <code class="ruby"> it &quot;raises NoMethodError when #to_sym fails for a key&quot; do</code>
1741
+ </li>
1742
+
1743
+ <li class="covered" data-hits="1" data-linenumber="13">
1744
+ <span class="hits">1</span>
1745
+
1746
+ <code class="ruby"> lambda {</code>
1747
+ </li>
1748
+
1749
+ <li class="covered" data-hits="1" data-linenumber="14">
1750
+ <span class="hits">1</span>
1751
+
1752
+ <code class="ruby"> have = { &#39;foo&#39; =&gt; 1, 2 =&gt; 2, :bar =&gt; 3 }</code>
1753
+ </li>
1754
+
1755
+ <li class="covered" data-hits="1" data-linenumber="15">
1756
+ <span class="hits">1</span>
1757
+
1758
+ <code class="ruby"> BB::Hash.symbolize_keys(have)</code>
1759
+ </li>
1760
+
1761
+ <li class="never" data-hits="" data-linenumber="16">
1762
+
1763
+
1764
+ <code class="ruby"> }.should raise_error NoMethodError</code>
1765
+ </li>
1766
+
1767
+ <li class="never" data-hits="" data-linenumber="17">
1768
+
1769
+
1770
+ <code class="ruby"> end</code>
1771
+ </li>
1772
+
1773
+ <li class="never" data-hits="" data-linenumber="18">
1774
+
1775
+
1776
+ <code class="ruby"> end</code>
1777
+ </li>
1778
+
1779
+ <li class="never" data-hits="" data-linenumber="19">
1780
+
1781
+
1782
+ <code class="ruby"></code>
1783
+ </li>
1784
+
1785
+ <li class="covered" data-hits="1" data-linenumber="20">
1786
+ <span class="hits">1</span>
1787
+
1788
+ <code class="ruby"> describe &quot;.flatten_prop_style&quot; do</code>
1789
+ </li>
1790
+
1791
+ <li class="covered" data-hits="1" data-linenumber="21">
1792
+ <span class="hits">1</span>
1793
+
1794
+ <code class="ruby"> it &quot;returns flattened hash&quot; do</code>
1795
+ </li>
1796
+
1797
+ <li class="covered" data-hits="1" data-linenumber="22">
1798
+ <span class="hits">1</span>
1799
+
1800
+ <code class="ruby"> have = {</code>
1801
+ </li>
1802
+
1803
+ <li class="never" data-hits="" data-linenumber="23">
1804
+
1805
+
1806
+ <code class="ruby"> :a=&gt; 1,</code>
1807
+ </li>
1808
+
1809
+ <li class="never" data-hits="" data-linenumber="24">
1810
+
1811
+
1812
+ <code class="ruby"> &#39;b&#39; =&gt; 2,</code>
1813
+ </li>
1814
+
1815
+ <li class="never" data-hits="" data-linenumber="25">
1816
+
1817
+
1818
+ <code class="ruby"> 3 =&gt; 3,</code>
1819
+ </li>
1820
+
1821
+ <li class="never" data-hits="" data-linenumber="26">
1822
+
1823
+
1824
+ <code class="ruby"> :array =&gt; [1,2,3],</code>
1825
+ </li>
1826
+
1827
+ <li class="never" data-hits="" data-linenumber="27">
1828
+
1829
+
1830
+ <code class="ruby"> &#39;nested&#39; =&gt; { &#39;a&#39; =&gt; 1, :b =&gt; 2, :c =&gt; 3 },</code>
1831
+ </li>
1832
+
1833
+ <li class="never" data-hits="" data-linenumber="28">
1834
+
1835
+
1836
+ <code class="ruby"> :double_nested =&gt; { :a =&gt; { :aa =&gt; 1 }, :b =&gt; { :bb =&gt; 2 }, :c =&gt; { :cc =&gt; 3 } },</code>
1837
+ </li>
1838
+
1839
+ <li class="never" data-hits="" data-linenumber="29">
1840
+
1841
+
1842
+ <code class="ruby"> :nested_with_array =&gt; { :a =&gt; { :aa =&gt; [:a, &#39;b&#39;, 3] }, :b =&gt; { :bb =&gt; [:a, &#39;b&#39;, 3] }, :c =&gt; { :cc =&gt; [:a, &#39;b&#39;, 3] } }</code>
1843
+ </li>
1844
+
1845
+ <li class="never" data-hits="" data-linenumber="30">
1846
+
1847
+
1848
+ <code class="ruby"> }</code>
1849
+ </li>
1850
+
1851
+ <li class="never" data-hits="" data-linenumber="31">
1852
+
1853
+
1854
+ <code class="ruby"></code>
1855
+ </li>
1856
+
1857
+ <li class="covered" data-hits="1" data-linenumber="32">
1858
+ <span class="hits">1</span>
1859
+
1860
+ <code class="ruby"> want = {</code>
1861
+ </li>
1862
+
1863
+ <li class="never" data-hits="" data-linenumber="33">
1864
+
1865
+
1866
+ <code class="ruby"> &quot;a&quot;=&gt;1,</code>
1867
+ </li>
1868
+
1869
+ <li class="never" data-hits="" data-linenumber="34">
1870
+
1871
+
1872
+ <code class="ruby"> &quot;b&quot;=&gt;2,</code>
1873
+ </li>
1874
+
1875
+ <li class="never" data-hits="" data-linenumber="35">
1876
+
1877
+
1878
+ <code class="ruby"> &quot;3&quot;=&gt;3,</code>
1879
+ </li>
1880
+
1881
+ <li class="never" data-hits="" data-linenumber="36">
1882
+
1883
+
1884
+ <code class="ruby"> &quot;array&quot;=&gt;&quot;1,2,3&quot;,</code>
1885
+ </li>
1886
+
1887
+ <li class="never" data-hits="" data-linenumber="37">
1888
+
1889
+
1890
+ <code class="ruby"> &quot;nested.a&quot;=&gt;1,</code>
1891
+ </li>
1892
+
1893
+ <li class="never" data-hits="" data-linenumber="38">
1894
+
1895
+
1896
+ <code class="ruby"> &quot;nested.b&quot;=&gt;2,</code>
1897
+ </li>
1898
+
1899
+ <li class="never" data-hits="" data-linenumber="39">
1900
+
1901
+
1902
+ <code class="ruby"> &quot;nested.c&quot;=&gt;3,</code>
1903
+ </li>
1904
+
1905
+ <li class="never" data-hits="" data-linenumber="40">
1906
+
1907
+
1908
+ <code class="ruby"> &quot;double_nested.a.aa&quot;=&gt;1,</code>
1909
+ </li>
1910
+
1911
+ <li class="never" data-hits="" data-linenumber="41">
1912
+
1913
+
1914
+ <code class="ruby"> &quot;double_nested.b.bb&quot;=&gt;2,</code>
1915
+ </li>
1916
+
1917
+ <li class="never" data-hits="" data-linenumber="42">
1918
+
1919
+
1920
+ <code class="ruby"> &quot;double_nested.c.cc&quot;=&gt;3,</code>
1921
+ </li>
1922
+
1923
+ <li class="never" data-hits="" data-linenumber="43">
1924
+
1925
+
1926
+ <code class="ruby"> &quot;nested_with_array.a.aa&quot;=&gt;&quot;a,b,3&quot;,</code>
1927
+ </li>
1928
+
1929
+ <li class="never" data-hits="" data-linenumber="44">
1930
+
1931
+
1932
+ <code class="ruby"> &quot;nested_with_array.b.bb&quot;=&gt;&quot;a,b,3&quot;,</code>
1933
+ </li>
1934
+
1935
+ <li class="never" data-hits="" data-linenumber="45">
1936
+
1937
+
1938
+ <code class="ruby"> &quot;nested_with_array.c.cc&quot;=&gt;&quot;a,b,3&quot;</code>
1939
+ </li>
1940
+
1941
+ <li class="never" data-hits="" data-linenumber="46">
1942
+
1943
+
1944
+ <code class="ruby"> }</code>
1945
+ </li>
1946
+
1947
+ <li class="covered" data-hits="1" data-linenumber="47">
1948
+ <span class="hits">1</span>
1949
+
1950
+ <code class="ruby"> BB::Hash::flatten_prop_style(have).should == want</code>
1951
+ </li>
1952
+
1953
+ <li class="never" data-hits="" data-linenumber="48">
1954
+
1955
+
1956
+ <code class="ruby"> end</code>
1957
+ </li>
1958
+
1959
+ <li class="never" data-hits="" data-linenumber="49">
1960
+
1961
+
1962
+ <code class="ruby"> end</code>
1963
+ </li>
1964
+
1965
+ <li class="never" data-hits="" data-linenumber="50">
1966
+
1967
+
1968
+ <code class="ruby">end</code>
1969
+ </li>
1970
+
1971
+ <li class="never" data-hits="" data-linenumber="51">
1972
+
1973
+
1974
+ <code class="ruby"></code>
1975
+ </li>
1976
+
1977
+ </ol>
1978
+ </pre>
1979
+ </div>
1980
+
1981
+ <div class="source_table" id="f0f2a0640dc412383156f37da73a9a143a48fe1b">
1982
+ <div class="header">
1983
+ <h3>spec/string_spec.rb</h3>
1984
+ <h4><span class="green">100.0 %</span> covered</h4>
1985
+ <div>
1986
+ <b>8</b> relevant lines.
1987
+ <span class="green"><b>8</b> lines covered</span> and
1988
+ <span class="red"><b>0</b> lines missed.</span>
1989
+ </div>
1990
+ </div>
1991
+
1992
+ <pre>
1993
+ <ol>
1994
+
1995
+ <li class="covered" data-hits="1" data-linenumber="1">
1996
+ <span class="hits">1</span>
1997
+
1998
+ <code class="ruby">require &#39;spec_helper&#39;</code>
1999
+ </li>
2000
+
2001
+ <li class="covered" data-hits="1" data-linenumber="2">
2002
+ <span class="hits">1</span>
2003
+
2004
+ <code class="ruby">require &#39;blackbox/string&#39;</code>
2005
+ </li>
2006
+
2007
+ <li class="never" data-hits="" data-linenumber="3">
2008
+
2009
+
2010
+ <code class="ruby"></code>
2011
+ </li>
2012
+
2013
+ <li class="covered" data-hits="1" data-linenumber="4">
2014
+ <span class="hits">1</span>
2015
+
2016
+ <code class="ruby">describe BB::String do</code>
2017
+ </li>
2018
+
2019
+ <li class="covered" data-hits="1" data-linenumber="5">
2020
+ <span class="hits">1</span>
2021
+
2022
+ <code class="ruby"> describe &#39;.strip_ansi&#39; do</code>
2023
+ </li>
2024
+
2025
+ <li class="covered" data-hits="1" data-linenumber="6">
2026
+ <span class="hits">1</span>
2027
+
2028
+ <code class="ruby"> it &quot;strips a few common escape sequences&quot; do</code>
2029
+ </li>
2030
+
2031
+ <li class="covered" data-hits="1" data-linenumber="7">
2032
+ <span class="hits">1</span>
2033
+
2034
+ <code class="ruby"> have = &quot;\e[31;1mX\e[AY\e[2JZ&quot;</code>
2035
+ </li>
2036
+
2037
+ <li class="covered" data-hits="1" data-linenumber="8">
2038
+ <span class="hits">1</span>
2039
+
2040
+ <code class="ruby"> want = &quot;XYZ&quot;</code>
2041
+ </li>
2042
+
2043
+ <li class="covered" data-hits="1" data-linenumber="9">
2044
+ <span class="hits">1</span>
2045
+
2046
+ <code class="ruby"> BB::String.strip_ansi(have).should == want</code>
2047
+ </li>
2048
+
2049
+ <li class="never" data-hits="" data-linenumber="10">
2050
+
2051
+
2052
+ <code class="ruby"> end</code>
2053
+ </li>
2054
+
2055
+ <li class="never" data-hits="" data-linenumber="11">
2056
+
2057
+
2058
+ <code class="ruby"> end</code>
2059
+ </li>
2060
+
2061
+ <li class="never" data-hits="" data-linenumber="12">
2062
+
2063
+
2064
+ <code class="ruby">end</code>
2065
+ </li>
2066
+
2067
+ <li class="never" data-hits="" data-linenumber="13">
2068
+
2069
+
2070
+ <code class="ruby"></code>
2071
+ </li>
2072
+
2073
+ </ol>
2074
+ </pre>
2075
+ </div>
2076
+
2077
+ </div>
2078
+ </div>
2079
+ </body>
2080
+ </html>