diversion 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (83) hide show
  1. checksums.yaml +7 -0
  2. checksums.yaml.gz.sig +0 -0
  3. data.tar.gz.sig +2 -0
  4. data/LICENSE.txt +22 -0
  5. data/README.md +193 -0
  6. data/Rakefile +7 -0
  7. data/diversion.gemspec +40 -0
  8. data/lib/diversion.rb +35 -0
  9. data/lib/diversion/client.rb +21 -0
  10. data/lib/diversion/configurable.rb +100 -0
  11. data/lib/diversion/decode.rb +21 -0
  12. data/lib/diversion/decode/json.rb +47 -0
  13. data/lib/diversion/decode/params.rb +55 -0
  14. data/lib/diversion/encode.rb +67 -0
  15. data/lib/diversion/encode/json.rb +31 -0
  16. data/lib/diversion/encode/params.rb +26 -0
  17. data/lib/diversion/error.rb +2 -0
  18. data/lib/diversion/error/bad_url_data_format.rb +6 -0
  19. data/lib/diversion/error/configuration_error.rb +6 -0
  20. data/lib/diversion/error/key_missing_error.rb +6 -0
  21. data/lib/diversion/error/uri_missing_error.rb +6 -0
  22. data/lib/diversion/mailer.rb +11 -0
  23. data/lib/diversion/signing.rb +19 -0
  24. data/lib/diversion/url.rb +43 -0
  25. data/lib/diversion/version.rb +17 -0
  26. data/spec/coverage/assets/0.7.1/application.css +1110 -0
  27. data/spec/coverage/assets/0.7.1/application.js +626 -0
  28. data/spec/coverage/assets/0.7.1/fancybox/blank.gif +0 -0
  29. data/spec/coverage/assets/0.7.1/fancybox/fancy_close.png +0 -0
  30. data/spec/coverage/assets/0.7.1/fancybox/fancy_loading.png +0 -0
  31. data/spec/coverage/assets/0.7.1/fancybox/fancy_nav_left.png +0 -0
  32. data/spec/coverage/assets/0.7.1/fancybox/fancy_nav_right.png +0 -0
  33. data/spec/coverage/assets/0.7.1/fancybox/fancy_shadow_e.png +0 -0
  34. data/spec/coverage/assets/0.7.1/fancybox/fancy_shadow_n.png +0 -0
  35. data/spec/coverage/assets/0.7.1/fancybox/fancy_shadow_ne.png +0 -0
  36. data/spec/coverage/assets/0.7.1/fancybox/fancy_shadow_nw.png +0 -0
  37. data/spec/coverage/assets/0.7.1/fancybox/fancy_shadow_s.png +0 -0
  38. data/spec/coverage/assets/0.7.1/fancybox/fancy_shadow_se.png +0 -0
  39. data/spec/coverage/assets/0.7.1/fancybox/fancy_shadow_sw.png +0 -0
  40. data/spec/coverage/assets/0.7.1/fancybox/fancy_shadow_w.png +0 -0
  41. data/spec/coverage/assets/0.7.1/fancybox/fancy_title_left.png +0 -0
  42. data/spec/coverage/assets/0.7.1/fancybox/fancy_title_main.png +0 -0
  43. data/spec/coverage/assets/0.7.1/fancybox/fancy_title_over.png +0 -0
  44. data/spec/coverage/assets/0.7.1/fancybox/fancy_title_right.png +0 -0
  45. data/spec/coverage/assets/0.7.1/fancybox/fancybox-x.png +0 -0
  46. data/spec/coverage/assets/0.7.1/fancybox/fancybox-y.png +0 -0
  47. data/spec/coverage/assets/0.7.1/fancybox/fancybox.png +0 -0
  48. data/spec/coverage/assets/0.7.1/favicon_green.png +0 -0
  49. data/spec/coverage/assets/0.7.1/favicon_red.png +0 -0
  50. data/spec/coverage/assets/0.7.1/favicon_yellow.png +0 -0
  51. data/spec/coverage/assets/0.7.1/loading.gif +0 -0
  52. data/spec/coverage/assets/0.7.1/magnify.png +0 -0
  53. data/spec/coverage/assets/0.7.1/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
  54. data/spec/coverage/assets/0.7.1/smoothness/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
  55. data/spec/coverage/assets/0.7.1/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
  56. data/spec/coverage/assets/0.7.1/smoothness/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
  57. data/spec/coverage/assets/0.7.1/smoothness/images/ui-bg_glass_75_dadada_1x400.png +0 -0
  58. data/spec/coverage/assets/0.7.1/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
  59. data/spec/coverage/assets/0.7.1/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
  60. data/spec/coverage/assets/0.7.1/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
  61. data/spec/coverage/assets/0.7.1/smoothness/images/ui-icons_222222_256x240.png +0 -0
  62. data/spec/coverage/assets/0.7.1/smoothness/images/ui-icons_2e83ff_256x240.png +0 -0
  63. data/spec/coverage/assets/0.7.1/smoothness/images/ui-icons_454545_256x240.png +0 -0
  64. data/spec/coverage/assets/0.7.1/smoothness/images/ui-icons_888888_256x240.png +0 -0
  65. data/spec/coverage/assets/0.7.1/smoothness/images/ui-icons_cd0a0a_256x240.png +0 -0
  66. data/spec/coverage/index.html +3146 -0
  67. data/spec/diversion/client_spec.rb +23 -0
  68. data/spec/diversion/configurable_spec.rb +128 -0
  69. data/spec/diversion/decode/json_decode_spec.rb +70 -0
  70. data/spec/diversion/decode/params_decode_spec.rb +74 -0
  71. data/spec/diversion/decode_spec.rb +12 -0
  72. data/spec/diversion/encode/json_encode_spec.rb +39 -0
  73. data/spec/diversion/encode/params_encode_spec.rb +39 -0
  74. data/spec/diversion/encode_spec.rb +30 -0
  75. data/spec/diversion/mailer_spec.rb +31 -0
  76. data/spec/diversion/support/global_shared_context.rb +29 -0
  77. data/spec/diversion/url_spec.rb +36 -0
  78. data/spec/fixtures/mail.html +13 -0
  79. data/spec/fixtures/sample_email.multipart +39 -0
  80. data/spec/fixtures/sample_email.text +12 -0
  81. data/spec/spec_helper.rb +84 -0
  82. metadata +323 -0
  83. metadata.gz.sig +0 -0
@@ -0,0 +1,3146 @@
1
+ <!DOCTYPE html>
2
+ <html xmlns='http://www.w3.org/1999/xhtml'>
3
+ <head>
4
+ <title>Code coverage for Spec</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-30T18:59:07+00:00">2013-03-30T18:59:07+00: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
+ 2.02
29
+ </span>
30
+ </span> hits/line)
31
+ </h2>
32
+ <a name="AllFiles"></a>
33
+ <div>
34
+ <b>9</b> files in total.
35
+ <b>271</b> relevant lines.
36
+ <span class="green"><b>271</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="#beb36a539815874a2e38d031648b8445814738ba" class="src_link" title="configurable_spec.rb">configurable_spec.rb</a></td>
55
+ <td class="green strong">100.0 %</td>
56
+ <td>128</td>
57
+ <td>78</td>
58
+ <td>78</td>
59
+ <td>0</td>
60
+ <td>3.2</td>
61
+ </tr>
62
+
63
+ <tr>
64
+ <td class="strong"><a href="#e1a7fc5640c87fa6fa98ec90fa1b17c8ca87bf2e" class="src_link" title="decode/json_decode_spec.rb">decode/json_decode_spec.rb</a></td>
65
+ <td class="green strong">100.0 %</td>
66
+ <td>70</td>
67
+ <td>46</td>
68
+ <td>46</td>
69
+ <td>0</td>
70
+ <td>1.0</td>
71
+ </tr>
72
+
73
+ <tr>
74
+ <td class="strong"><a href="#fd74014db3bf2e13efedbd4af51ffd71e795c880" class="src_link" title="decode/params_decode_spec.rb">decode/params_decode_spec.rb</a></td>
75
+ <td class="green strong">100.0 %</td>
76
+ <td>74</td>
77
+ <td>48</td>
78
+ <td>48</td>
79
+ <td>0</td>
80
+ <td>1.1</td>
81
+ </tr>
82
+
83
+ <tr>
84
+ <td class="strong"><a href="#a52e7c4b683842302e76abc21d83ef3b7dc89685" class="src_link" title="decode_spec.rb">decode_spec.rb</a></td>
85
+ <td class="green strong">100.0 %</td>
86
+ <td>12</td>
87
+ <td>5</td>
88
+ <td>5</td>
89
+ <td>0</td>
90
+ <td>1.2</td>
91
+ </tr>
92
+
93
+ <tr>
94
+ <td class="strong"><a href="#785b6692db21b24fc9fc8523d4eda0718b9dfa49" class="src_link" title="encode_spec.rb">encode_spec.rb</a></td>
95
+ <td class="green strong">100.0 %</td>
96
+ <td>30</td>
97
+ <td>15</td>
98
+ <td>15</td>
99
+ <td>0</td>
100
+ <td>1.1</td>
101
+ </tr>
102
+
103
+ <tr>
104
+ <td class="strong"><a href="#ae9421f4607208f7c70b12e66586cdc415b7a355" class="src_link" title="json_encode_spec.rb">json_encode_spec.rb</a></td>
105
+ <td class="green strong">100.0 %</td>
106
+ <td>39</td>
107
+ <td>21</td>
108
+ <td>21</td>
109
+ <td>0</td>
110
+ <td>1.0</td>
111
+ </tr>
112
+
113
+ <tr>
114
+ <td class="strong"><a href="#3d3f06c48e5c0515d62b241e1473efb27036296e" class="src_link" title="params_encode_spec.rb">params_encode_spec.rb</a></td>
115
+ <td class="green strong">100.0 %</td>
116
+ <td>39</td>
117
+ <td>21</td>
118
+ <td>21</td>
119
+ <td>0</td>
120
+ <td>1.0</td>
121
+ </tr>
122
+
123
+ <tr>
124
+ <td class="strong"><a href="#7415e83dc14ec7500a4a9a66846d7c0948f9c248" class="src_link" title="support/global_shared_context.rb">support/global_shared_context.rb</a></td>
125
+ <td class="green strong">100.0 %</td>
126
+ <td>29</td>
127
+ <td>22</td>
128
+ <td>22</td>
129
+ <td>0</td>
130
+ <td>7.6</td>
131
+ </tr>
132
+
133
+ <tr>
134
+ <td class="strong"><a href="#2eeadc78f5528a6adfeeaac28ef4a4ae46fda94a" class="src_link" title="url_spec.rb">url_spec.rb</a></td>
135
+ <td class="green strong">100.0 %</td>
136
+ <td>22</td>
137
+ <td>15</td>
138
+ <td>15</td>
139
+ <td>0</td>
140
+ <td>1.0</td>
141
+ </tr>
142
+
143
+ </tbody>
144
+ </table>
145
+ </div>
146
+
147
+
148
+
149
+ <div class="file_list_container" id="Libraries">
150
+ <h2>
151
+ <span class="group_name">Libraries</span>
152
+ (<span class="covered_percent"><span class="green">100.0%</span></span>
153
+ covered at
154
+ <span class="covered_strength">
155
+ <span class="red">
156
+ 0.0
157
+ </span>
158
+ </span> hits/line)
159
+ </h2>
160
+ <a name="Libraries"></a>
161
+ <div>
162
+ <b>0</b> files in total.
163
+ <b>0.0</b> relevant lines.
164
+ <span class="green"><b>0.0</b> lines covered</span> and
165
+ <span class="red"><b>0.0</b> lines missed </span>
166
+ </div>
167
+ <table class="file_list">
168
+ <thead>
169
+ <tr>
170
+ <th>File</th>
171
+ <th>% covered</th>
172
+ <th>Lines</th>
173
+ <th>Relevant Lines</th>
174
+ <th>Lines covered</th>
175
+ <th>Lines missed</th>
176
+ <th>Avg. Hits / Line</th>
177
+ </tr>
178
+ </thead>
179
+ <tbody>
180
+
181
+ </tbody>
182
+ </table>
183
+ </div>
184
+
185
+
186
+ <div class="file_list_container" id="Spec">
187
+ <h2>
188
+ <span class="group_name">Spec</span>
189
+ (<span class="covered_percent"><span class="green">100.0%</span></span>
190
+ covered at
191
+ <span class="covered_strength">
192
+ <span class="green">
193
+ 2.02
194
+ </span>
195
+ </span> hits/line)
196
+ </h2>
197
+ <a name="Spec"></a>
198
+ <div>
199
+ <b>9</b> files in total.
200
+ <b>271</b> relevant lines.
201
+ <span class="green"><b>271</b> lines covered</span> and
202
+ <span class="red"><b>0</b> lines missed </span>
203
+ </div>
204
+ <table class="file_list">
205
+ <thead>
206
+ <tr>
207
+ <th>File</th>
208
+ <th>% covered</th>
209
+ <th>Lines</th>
210
+ <th>Relevant Lines</th>
211
+ <th>Lines covered</th>
212
+ <th>Lines missed</th>
213
+ <th>Avg. Hits / Line</th>
214
+ </tr>
215
+ </thead>
216
+ <tbody>
217
+
218
+ <tr>
219
+ <td class="strong"><a href="#beb36a539815874a2e38d031648b8445814738ba" class="src_link" title="configurable_spec.rb">configurable_spec.rb</a></td>
220
+ <td class="green strong">100.0 %</td>
221
+ <td>128</td>
222
+ <td>78</td>
223
+ <td>78</td>
224
+ <td>0</td>
225
+ <td>3.2</td>
226
+ </tr>
227
+
228
+ <tr>
229
+ <td class="strong"><a href="#e1a7fc5640c87fa6fa98ec90fa1b17c8ca87bf2e" class="src_link" title="decode/json_decode_spec.rb">decode/json_decode_spec.rb</a></td>
230
+ <td class="green strong">100.0 %</td>
231
+ <td>70</td>
232
+ <td>46</td>
233
+ <td>46</td>
234
+ <td>0</td>
235
+ <td>1.0</td>
236
+ </tr>
237
+
238
+ <tr>
239
+ <td class="strong"><a href="#fd74014db3bf2e13efedbd4af51ffd71e795c880" class="src_link" title="decode/params_decode_spec.rb">decode/params_decode_spec.rb</a></td>
240
+ <td class="green strong">100.0 %</td>
241
+ <td>74</td>
242
+ <td>48</td>
243
+ <td>48</td>
244
+ <td>0</td>
245
+ <td>1.1</td>
246
+ </tr>
247
+
248
+ <tr>
249
+ <td class="strong"><a href="#a52e7c4b683842302e76abc21d83ef3b7dc89685" class="src_link" title="decode_spec.rb">decode_spec.rb</a></td>
250
+ <td class="green strong">100.0 %</td>
251
+ <td>12</td>
252
+ <td>5</td>
253
+ <td>5</td>
254
+ <td>0</td>
255
+ <td>1.2</td>
256
+ </tr>
257
+
258
+ <tr>
259
+ <td class="strong"><a href="#785b6692db21b24fc9fc8523d4eda0718b9dfa49" class="src_link" title="encode_spec.rb">encode_spec.rb</a></td>
260
+ <td class="green strong">100.0 %</td>
261
+ <td>30</td>
262
+ <td>15</td>
263
+ <td>15</td>
264
+ <td>0</td>
265
+ <td>1.1</td>
266
+ </tr>
267
+
268
+ <tr>
269
+ <td class="strong"><a href="#ae9421f4607208f7c70b12e66586cdc415b7a355" class="src_link" title="json_encode_spec.rb">json_encode_spec.rb</a></td>
270
+ <td class="green strong">100.0 %</td>
271
+ <td>39</td>
272
+ <td>21</td>
273
+ <td>21</td>
274
+ <td>0</td>
275
+ <td>1.0</td>
276
+ </tr>
277
+
278
+ <tr>
279
+ <td class="strong"><a href="#3d3f06c48e5c0515d62b241e1473efb27036296e" class="src_link" title="params_encode_spec.rb">params_encode_spec.rb</a></td>
280
+ <td class="green strong">100.0 %</td>
281
+ <td>39</td>
282
+ <td>21</td>
283
+ <td>21</td>
284
+ <td>0</td>
285
+ <td>1.0</td>
286
+ </tr>
287
+
288
+ <tr>
289
+ <td class="strong"><a href="#7415e83dc14ec7500a4a9a66846d7c0948f9c248" class="src_link" title="support/global_shared_context.rb">support/global_shared_context.rb</a></td>
290
+ <td class="green strong">100.0 %</td>
291
+ <td>29</td>
292
+ <td>22</td>
293
+ <td>22</td>
294
+ <td>0</td>
295
+ <td>7.6</td>
296
+ </tr>
297
+
298
+ <tr>
299
+ <td class="strong"><a href="#2eeadc78f5528a6adfeeaac28ef4a4ae46fda94a" class="src_link" title="url_spec.rb">url_spec.rb</a></td>
300
+ <td class="green strong">100.0 %</td>
301
+ <td>22</td>
302
+ <td>15</td>
303
+ <td>15</td>
304
+ <td>0</td>
305
+ <td>1.0</td>
306
+ </tr>
307
+
308
+ </tbody>
309
+ </table>
310
+ </div>
311
+
312
+
313
+ </div>
314
+
315
+ <div id="footer">
316
+ Generated by <a href="http://github.com/colszowka/simplecov">simplecov</a> v0.7.1
317
+ and simplecov-html v0.7.1<br/>
318
+ using RSpec
319
+ </div>
320
+
321
+ <div class="source_files">
322
+
323
+ <div class="source_table" id="beb36a539815874a2e38d031648b8445814738ba">
324
+ <div class="header">
325
+ <h3>configurable_spec.rb</h3>
326
+ <h4><span class="green">100.0 %</span> covered</h4>
327
+ <div>
328
+ <b>78</b> relevant lines.
329
+ <span class="green"><b>78</b> lines covered</span> and
330
+ <span class="red"><b>0</b> lines missed.</span>
331
+ </div>
332
+ </div>
333
+
334
+ <pre>
335
+ <ol>
336
+
337
+ <li class="covered" data-hits="1" data-linenumber="1">
338
+ <span class="hits">1</span>
339
+
340
+ <code class="ruby">require 'spec_helper'</code>
341
+ </li>
342
+
343
+ <li class="never" data-hits="" data-linenumber="2">
344
+
345
+
346
+ <code class="ruby"></code>
347
+ </li>
348
+
349
+ <li class="covered" data-hits="1" data-linenumber="3">
350
+ <span class="hits">1</span>
351
+
352
+ <code class="ruby">class ConfigTestStub</code>
353
+ </li>
354
+
355
+ <li class="covered" data-hits="1" data-linenumber="4">
356
+ <span class="hits">1</span>
357
+
358
+ <code class="ruby"> include Diversion::Configurable</code>
359
+ </li>
360
+
361
+ <li class="never" data-hits="" data-linenumber="5">
362
+
363
+
364
+ <code class="ruby">end</code>
365
+ </li>
366
+
367
+ <li class="never" data-hits="" data-linenumber="6">
368
+
369
+
370
+ <code class="ruby"></code>
371
+ </li>
372
+
373
+ <li class="covered" data-hits="1" data-linenumber="7">
374
+ <span class="hits">1</span>
375
+
376
+ <code class="ruby">describe Diversion::Configurable do</code>
377
+ </li>
378
+
379
+ <li class="never" data-hits="" data-linenumber="8">
380
+
381
+
382
+ <code class="ruby"></code>
383
+ </li>
384
+
385
+ <li class="covered" data-hits="30" data-linenumber="9">
386
+ <span class="hits">30</span>
387
+
388
+ <code class="ruby"> let(:config) { config = ConfigTestStub.new; config.reset!; config }</code>
389
+ </li>
390
+
391
+ <li class="never" data-hits="" data-linenumber="10">
392
+
393
+
394
+ <code class="ruby"></code>
395
+ </li>
396
+
397
+ <li class="covered" data-hits="59" data-linenumber="11">
398
+ <span class="hits">59</span>
399
+
400
+ <code class="ruby"> def set_config(&amp;block) config.configure do |c| c.instance_eval(&amp;block) end; end</code>
401
+ </li>
402
+
403
+ <li class="covered" data-hits="9" data-linenumber="12">
404
+ <span class="hits">9</span>
405
+
406
+ <code class="ruby"> def host(value); set_config{|c|c.host = value}; end</code>
407
+ </li>
408
+
409
+ <li class="covered" data-hits="9" data-linenumber="13">
410
+ <span class="hits">9</span>
411
+
412
+ <code class="ruby"> def path(value); set_config{|c|c.path = value}; end</code>
413
+ </li>
414
+
415
+ <li class="covered" data-hits="11" data-linenumber="14">
416
+ <span class="hits">11</span>
417
+
418
+ <code class="ruby"> def port(value); set_config{|c|c.port = value}; end</code>
419
+ </li>
420
+
421
+ <li class="covered" data-hits="9" data-linenumber="15">
422
+ <span class="hits">9</span>
423
+
424
+ <code class="ruby"> def encode_uris(value); set_config{|c|c.encode_uris = value}; end</code>
425
+ </li>
426
+
427
+ <li class="covered" data-hits="13" data-linenumber="16">
428
+ <span class="hits">13</span>
429
+
430
+ <code class="ruby"> def sign_length(value); set_config{|c|c.sign_length = value}; end</code>
431
+ </li>
432
+
433
+ <li class="covered" data-hits="7" data-linenumber="17">
434
+ <span class="hits">7</span>
435
+
436
+ <code class="ruby"> def url_encoding(value); set_config{|c|c.url_encoding = value}; end</code>
437
+ </li>
438
+
439
+ <li class="covered" data-hits="7" data-linenumber="18">
440
+ <span class="hits">7</span>
441
+
442
+ <code class="ruby"> def url_decoding(value); set_config{|c|c.url_decoding = value}; end</code>
443
+ </li>
444
+
445
+ <li class="never" data-hits="" data-linenumber="19">
446
+
447
+
448
+ <code class="ruby"></code>
449
+ </li>
450
+
451
+ <li class="covered" data-hits="1" data-linenumber="20">
452
+ <span class="hits">1</span>
453
+
454
+ <code class="ruby"> describe &quot;host&quot; do</code>
455
+ </li>
456
+
457
+ <li class="covered" data-hits="1" data-linenumber="21">
458
+ <span class="hits">1</span>
459
+
460
+ <code class="ruby"> it &quot;must be a string&quot; do</code>
461
+ </li>
462
+
463
+ <li class="covered" data-hits="2" data-linenumber="22">
464
+ <span class="hits">2</span>
465
+
466
+ <code class="ruby"> expect{host(1)}.to raise_error</code>
467
+ </li>
468
+
469
+ <li class="never" data-hits="" data-linenumber="23">
470
+
471
+
472
+ <code class="ruby"> end</code>
473
+ </li>
474
+
475
+ <li class="covered" data-hits="1" data-linenumber="24">
476
+ <span class="hits">1</span>
477
+
478
+ <code class="ruby"> it &quot;accepts string type&quot; do</code>
479
+ </li>
480
+
481
+ <li class="covered" data-hits="2" data-linenumber="25">
482
+ <span class="hits">2</span>
483
+
484
+ <code class="ruby"> expect{host('test')}.to_not raise_error</code>
485
+ </li>
486
+
487
+ <li class="never" data-hits="" data-linenumber="26">
488
+
489
+
490
+ <code class="ruby"> end</code>
491
+ </li>
492
+
493
+ <li class="covered" data-hits="1" data-linenumber="27">
494
+ <span class="hits">1</span>
495
+
496
+ <code class="ruby"> it &quot;cannot end with trailing slash&quot; do</code>
497
+ </li>
498
+
499
+ <li class="covered" data-hits="2" data-linenumber="28">
500
+ <span class="hits">2</span>
501
+
502
+ <code class="ruby"> expect{host('test/')}.to raise_error</code>
503
+ </li>
504
+
505
+ <li class="never" data-hits="" data-linenumber="29">
506
+
507
+
508
+ <code class="ruby"> end</code>
509
+ </li>
510
+
511
+ <li class="covered" data-hits="1" data-linenumber="30">
512
+ <span class="hits">1</span>
513
+
514
+ <code class="ruby"> it &quot;doesnt accept nil&quot; do</code>
515
+ </li>
516
+
517
+ <li class="covered" data-hits="2" data-linenumber="31">
518
+ <span class="hits">2</span>
519
+
520
+ <code class="ruby"> expect{host(nil)}.to raise_error</code>
521
+ </li>
522
+
523
+ <li class="never" data-hits="" data-linenumber="32">
524
+
525
+
526
+ <code class="ruby"> end</code>
527
+ </li>
528
+
529
+ <li class="never" data-hits="" data-linenumber="33">
530
+
531
+
532
+ <code class="ruby"> end</code>
533
+ </li>
534
+
535
+ <li class="never" data-hits="" data-linenumber="34">
536
+
537
+
538
+ <code class="ruby"></code>
539
+ </li>
540
+
541
+ <li class="covered" data-hits="1" data-linenumber="35">
542
+ <span class="hits">1</span>
543
+
544
+ <code class="ruby"> describe &quot;path&quot; do</code>
545
+ </li>
546
+
547
+ <li class="covered" data-hits="1" data-linenumber="36">
548
+ <span class="hits">1</span>
549
+
550
+ <code class="ruby"> it &quot;must be a string&quot; do</code>
551
+ </li>
552
+
553
+ <li class="covered" data-hits="2" data-linenumber="37">
554
+ <span class="hits">2</span>
555
+
556
+ <code class="ruby"> expect{path(1)}.to raise_error</code>
557
+ </li>
558
+
559
+ <li class="never" data-hits="" data-linenumber="38">
560
+
561
+
562
+ <code class="ruby"> end</code>
563
+ </li>
564
+
565
+ <li class="covered" data-hits="1" data-linenumber="39">
566
+ <span class="hits">1</span>
567
+
568
+ <code class="ruby"> it &quot;accepts string type&quot; do</code>
569
+ </li>
570
+
571
+ <li class="covered" data-hits="2" data-linenumber="40">
572
+ <span class="hits">2</span>
573
+
574
+ <code class="ruby"> expect{path('test/')}.to_not raise_error</code>
575
+ </li>
576
+
577
+ <li class="never" data-hits="" data-linenumber="41">
578
+
579
+
580
+ <code class="ruby"> end</code>
581
+ </li>
582
+
583
+ <li class="covered" data-hits="1" data-linenumber="42">
584
+ <span class="hits">1</span>
585
+
586
+ <code class="ruby"> it &quot;must end with trailing slash&quot; do</code>
587
+ </li>
588
+
589
+ <li class="covered" data-hits="2" data-linenumber="43">
590
+ <span class="hits">2</span>
591
+
592
+ <code class="ruby"> expect{path('test')}.to raise_error</code>
593
+ </li>
594
+
595
+ <li class="never" data-hits="" data-linenumber="44">
596
+
597
+
598
+ <code class="ruby"> end</code>
599
+ </li>
600
+
601
+ <li class="covered" data-hits="1" data-linenumber="45">
602
+ <span class="hits">1</span>
603
+
604
+ <code class="ruby"> it &quot;doesnt accept nil&quot; do</code>
605
+ </li>
606
+
607
+ <li class="covered" data-hits="2" data-linenumber="46">
608
+ <span class="hits">2</span>
609
+
610
+ <code class="ruby"> expect{path(nil)}.to raise_error</code>
611
+ </li>
612
+
613
+ <li class="never" data-hits="" data-linenumber="47">
614
+
615
+
616
+ <code class="ruby"> end</code>
617
+ </li>
618
+
619
+ <li class="never" data-hits="" data-linenumber="48">
620
+
621
+
622
+ <code class="ruby"> end</code>
623
+ </li>
624
+
625
+ <li class="never" data-hits="" data-linenumber="49">
626
+
627
+
628
+ <code class="ruby"></code>
629
+ </li>
630
+
631
+ <li class="covered" data-hits="1" data-linenumber="50">
632
+ <span class="hits">1</span>
633
+
634
+ <code class="ruby"> describe &quot;port&quot; do</code>
635
+ </li>
636
+
637
+ <li class="covered" data-hits="1" data-linenumber="51">
638
+ <span class="hits">1</span>
639
+
640
+ <code class="ruby"> it &quot;must be an integer&quot; do</code>
641
+ </li>
642
+
643
+ <li class="covered" data-hits="2" data-linenumber="52">
644
+ <span class="hits">2</span>
645
+
646
+ <code class="ruby"> expect{port('test')}.to raise_error</code>
647
+ </li>
648
+
649
+ <li class="never" data-hits="" data-linenumber="53">
650
+
651
+
652
+ <code class="ruby"> end</code>
653
+ </li>
654
+
655
+ <li class="covered" data-hits="1" data-linenumber="54">
656
+ <span class="hits">1</span>
657
+
658
+ <code class="ruby"> it &quot;accepts an integer&quot; do</code>
659
+ </li>
660
+
661
+ <li class="covered" data-hits="2" data-linenumber="55">
662
+ <span class="hits">2</span>
663
+
664
+ <code class="ruby"> expect{port(1)}.to_not raise_error</code>
665
+ </li>
666
+
667
+ <li class="never" data-hits="" data-linenumber="56">
668
+
669
+
670
+ <code class="ruby"> end</code>
671
+ </li>
672
+
673
+ <li class="covered" data-hits="1" data-linenumber="57">
674
+ <span class="hits">1</span>
675
+
676
+ <code class="ruby"> it &quot;does not accept 0&quot; do</code>
677
+ </li>
678
+
679
+ <li class="covered" data-hits="2" data-linenumber="58">
680
+ <span class="hits">2</span>
681
+
682
+ <code class="ruby"> expect{port(0)}.to raise_error</code>
683
+ </li>
684
+
685
+ <li class="never" data-hits="" data-linenumber="59">
686
+
687
+
688
+ <code class="ruby"> end</code>
689
+ </li>
690
+
691
+ <li class="covered" data-hits="1" data-linenumber="60">
692
+ <span class="hits">1</span>
693
+
694
+ <code class="ruby"> it &quot;does not accept &lt;0&quot; do</code>
695
+ </li>
696
+
697
+ <li class="covered" data-hits="2" data-linenumber="61">
698
+ <span class="hits">2</span>
699
+
700
+ <code class="ruby"> expect{port(-1)}.to raise_error</code>
701
+ </li>
702
+
703
+ <li class="never" data-hits="" data-linenumber="62">
704
+
705
+
706
+ <code class="ruby"> end</code>
707
+ </li>
708
+
709
+ <li class="covered" data-hits="1" data-linenumber="63">
710
+ <span class="hits">1</span>
711
+
712
+ <code class="ruby"> it &quot;doesnt accept nil&quot; do</code>
713
+ </li>
714
+
715
+ <li class="covered" data-hits="2" data-linenumber="64">
716
+ <span class="hits">2</span>
717
+
718
+ <code class="ruby"> expect{port(nil)}.to raise_error</code>
719
+ </li>
720
+
721
+ <li class="never" data-hits="" data-linenumber="65">
722
+
723
+
724
+ <code class="ruby"> end</code>
725
+ </li>
726
+
727
+ <li class="never" data-hits="" data-linenumber="66">
728
+
729
+
730
+ <code class="ruby"> end</code>
731
+ </li>
732
+
733
+ <li class="never" data-hits="" data-linenumber="67">
734
+
735
+
736
+ <code class="ruby"></code>
737
+ </li>
738
+
739
+ <li class="covered" data-hits="1" data-linenumber="68">
740
+ <span class="hits">1</span>
741
+
742
+ <code class="ruby"> describe &quot;sign_length&quot; do</code>
743
+ </li>
744
+
745
+ <li class="covered" data-hits="1" data-linenumber="69">
746
+ <span class="hits">1</span>
747
+
748
+ <code class="ruby"> it &quot;must be an integer&quot; do</code>
749
+ </li>
750
+
751
+ <li class="covered" data-hits="2" data-linenumber="70">
752
+ <span class="hits">2</span>
753
+
754
+ <code class="ruby"> expect{sign_length('test')}.to raise_error</code>
755
+ </li>
756
+
757
+ <li class="never" data-hits="" data-linenumber="71">
758
+
759
+
760
+ <code class="ruby"> end</code>
761
+ </li>
762
+
763
+ <li class="covered" data-hits="1" data-linenumber="72">
764
+ <span class="hits">1</span>
765
+
766
+ <code class="ruby"> it &quot;accepts 0 (disaled)&quot; do</code>
767
+ </li>
768
+
769
+ <li class="covered" data-hits="2" data-linenumber="73">
770
+ <span class="hits">2</span>
771
+
772
+ <code class="ruby"> expect{sign_length(0)}.to_not raise_error</code>
773
+ </li>
774
+
775
+ <li class="never" data-hits="" data-linenumber="74">
776
+
777
+
778
+ <code class="ruby"> end</code>
779
+ </li>
780
+
781
+ <li class="covered" data-hits="1" data-linenumber="75">
782
+ <span class="hits">1</span>
783
+
784
+ <code class="ruby"> it &quot;accepts integer at lower range&quot; do</code>
785
+ </li>
786
+
787
+ <li class="covered" data-hits="2" data-linenumber="76">
788
+ <span class="hits">2</span>
789
+
790
+ <code class="ruby"> expect{sign_length(1)}.to_not raise_error</code>
791
+ </li>
792
+
793
+ <li class="never" data-hits="" data-linenumber="77">
794
+
795
+
796
+ <code class="ruby"> end</code>
797
+ </li>
798
+
799
+ <li class="covered" data-hits="1" data-linenumber="78">
800
+ <span class="hits">1</span>
801
+
802
+ <code class="ruby"> it &quot;accepts integer at higher range&quot; do</code>
803
+ </li>
804
+
805
+ <li class="covered" data-hits="2" data-linenumber="79">
806
+ <span class="hits">2</span>
807
+
808
+ <code class="ruby"> expect{sign_length(Diversion::Signing::MAX_SIGN_LENGTH)}.to_not raise_error</code>
809
+ </li>
810
+
811
+ <li class="never" data-hits="" data-linenumber="80">
812
+
813
+
814
+ <code class="ruby"> end</code>
815
+ </li>
816
+
817
+ <li class="covered" data-hits="1" data-linenumber="81">
818
+ <span class="hits">1</span>
819
+
820
+ <code class="ruby"> it &quot;does not accept &lt;0&quot; do</code>
821
+ </li>
822
+
823
+ <li class="covered" data-hits="2" data-linenumber="82">
824
+ <span class="hits">2</span>
825
+
826
+ <code class="ruby"> expect{sign_length(-1)}.to raise_error</code>
827
+ </li>
828
+
829
+ <li class="never" data-hits="" data-linenumber="83">
830
+
831
+
832
+ <code class="ruby"> end</code>
833
+ </li>
834
+
835
+ <li class="covered" data-hits="1" data-linenumber="84">
836
+ <span class="hits">1</span>
837
+
838
+ <code class="ruby"> it &quot;doesnt accept nil&quot; do</code>
839
+ </li>
840
+
841
+ <li class="covered" data-hits="2" data-linenumber="85">
842
+ <span class="hits">2</span>
843
+
844
+ <code class="ruby"> expect{sign_length(nil)}.to raise_error</code>
845
+ </li>
846
+
847
+ <li class="never" data-hits="" data-linenumber="86">
848
+
849
+
850
+ <code class="ruby"> end</code>
851
+ </li>
852
+
853
+ <li class="never" data-hits="" data-linenumber="87">
854
+
855
+
856
+ <code class="ruby"> end</code>
857
+ </li>
858
+
859
+ <li class="never" data-hits="" data-linenumber="88">
860
+
861
+
862
+ <code class="ruby"></code>
863
+ </li>
864
+
865
+ <li class="covered" data-hits="1" data-linenumber="89">
866
+ <span class="hits">1</span>
867
+
868
+ <code class="ruby"> describe &quot;encode_uris&quot; do</code>
869
+ </li>
870
+
871
+ <li class="covered" data-hits="1" data-linenumber="90">
872
+ <span class="hits">1</span>
873
+
874
+ <code class="ruby"> it &quot;must be an array&quot; do</code>
875
+ </li>
876
+
877
+ <li class="covered" data-hits="2" data-linenumber="91">
878
+ <span class="hits">2</span>
879
+
880
+ <code class="ruby"> expect{encode_uris('test')}.to raise_error</code>
881
+ </li>
882
+
883
+ <li class="never" data-hits="" data-linenumber="92">
884
+
885
+
886
+ <code class="ruby"> end</code>
887
+ </li>
888
+
889
+ <li class="covered" data-hits="1" data-linenumber="93">
890
+ <span class="hits">1</span>
891
+
892
+ <code class="ruby"> it &quot;accepts uri&quot; do</code>
893
+ </li>
894
+
895
+ <li class="covered" data-hits="2" data-linenumber="94">
896
+ <span class="hits">2</span>
897
+
898
+ <code class="ruby"> expect{encode_uris(['http'])}.to_not raise_error</code>
899
+ </li>
900
+
901
+ <li class="never" data-hits="" data-linenumber="95">
902
+
903
+
904
+ <code class="ruby"> end</code>
905
+ </li>
906
+
907
+ <li class="covered" data-hits="1" data-linenumber="96">
908
+ <span class="hits">1</span>
909
+
910
+ <code class="ruby"> it &quot;doesnt accept nil&quot; do</code>
911
+ </li>
912
+
913
+ <li class="covered" data-hits="2" data-linenumber="97">
914
+ <span class="hits">2</span>
915
+
916
+ <code class="ruby"> expect{encode_uris(nil)}.to raise_error</code>
917
+ </li>
918
+
919
+ <li class="never" data-hits="" data-linenumber="98">
920
+
921
+
922
+ <code class="ruby"> end</code>
923
+ </li>
924
+
925
+ <li class="covered" data-hits="1" data-linenumber="99">
926
+ <span class="hits">1</span>
927
+
928
+ <code class="ruby"> it &quot;doesnt accept empty array&quot; do</code>
929
+ </li>
930
+
931
+ <li class="covered" data-hits="2" data-linenumber="100">
932
+ <span class="hits">2</span>
933
+
934
+ <code class="ruby"> expect{encode_uris([])}.to raise_error</code>
935
+ </li>
936
+
937
+ <li class="never" data-hits="" data-linenumber="101">
938
+
939
+
940
+ <code class="ruby"> end</code>
941
+ </li>
942
+
943
+ <li class="never" data-hits="" data-linenumber="102">
944
+
945
+
946
+ <code class="ruby"> end</code>
947
+ </li>
948
+
949
+ <li class="never" data-hits="" data-linenumber="103">
950
+
951
+
952
+ <code class="ruby"></code>
953
+ </li>
954
+
955
+ <li class="covered" data-hits="1" data-linenumber="104">
956
+ <span class="hits">1</span>
957
+
958
+ <code class="ruby"> describe &quot;url_encoding&quot; do</code>
959
+ </li>
960
+
961
+ <li class="covered" data-hits="1" data-linenumber="105">
962
+ <span class="hits">1</span>
963
+
964
+ <code class="ruby"> it &quot;must be a module&quot; do</code>
965
+ </li>
966
+
967
+ <li class="covered" data-hits="2" data-linenumber="106">
968
+ <span class="hits">2</span>
969
+
970
+ <code class="ruby"> expect{url_encoding('test')}.to raise_error</code>
971
+ </li>
972
+
973
+ <li class="never" data-hits="" data-linenumber="107">
974
+
975
+
976
+ <code class="ruby"> end</code>
977
+ </li>
978
+
979
+ <li class="covered" data-hits="1" data-linenumber="108">
980
+ <span class="hits">1</span>
981
+
982
+ <code class="ruby"> it &quot;accepts a valid module&quot; do</code>
983
+ </li>
984
+
985
+ <li class="covered" data-hits="2" data-linenumber="109">
986
+ <span class="hits">2</span>
987
+
988
+ <code class="ruby"> expect{url_encoding(Diversion::Encode::Json)}.to_not raise_error</code>
989
+ </li>
990
+
991
+ <li class="never" data-hits="" data-linenumber="110">
992
+
993
+
994
+ <code class="ruby"> end</code>
995
+ </li>
996
+
997
+ <li class="covered" data-hits="1" data-linenumber="111">
998
+ <span class="hits">1</span>
999
+
1000
+ <code class="ruby"> it &quot;doesn't accept an invalid module&quot; do</code>
1001
+ </li>
1002
+
1003
+ <li class="covered" data-hits="2" data-linenumber="112">
1004
+ <span class="hits">2</span>
1005
+
1006
+ <code class="ruby"> expect{url_encoding(Diversion::Decode::Json)}.to raise_error</code>
1007
+ </li>
1008
+
1009
+ <li class="never" data-hits="" data-linenumber="113">
1010
+
1011
+
1012
+ <code class="ruby"> end</code>
1013
+ </li>
1014
+
1015
+ <li class="never" data-hits="" data-linenumber="114">
1016
+
1017
+
1018
+ <code class="ruby"> end</code>
1019
+ </li>
1020
+
1021
+ <li class="never" data-hits="" data-linenumber="115">
1022
+
1023
+
1024
+ <code class="ruby"></code>
1025
+ </li>
1026
+
1027
+ <li class="covered" data-hits="1" data-linenumber="116">
1028
+ <span class="hits">1</span>
1029
+
1030
+ <code class="ruby"> describe &quot;url_decoding&quot; do</code>
1031
+ </li>
1032
+
1033
+ <li class="covered" data-hits="1" data-linenumber="117">
1034
+ <span class="hits">1</span>
1035
+
1036
+ <code class="ruby"> it &quot;must be a module&quot; do</code>
1037
+ </li>
1038
+
1039
+ <li class="covered" data-hits="2" data-linenumber="118">
1040
+ <span class="hits">2</span>
1041
+
1042
+ <code class="ruby"> expect{url_decoding('test')}.to raise_error</code>
1043
+ </li>
1044
+
1045
+ <li class="never" data-hits="" data-linenumber="119">
1046
+
1047
+
1048
+ <code class="ruby"> end</code>
1049
+ </li>
1050
+
1051
+ <li class="covered" data-hits="1" data-linenumber="120">
1052
+ <span class="hits">1</span>
1053
+
1054
+ <code class="ruby"> it &quot;accepts a valid module&quot; do</code>
1055
+ </li>
1056
+
1057
+ <li class="covered" data-hits="2" data-linenumber="121">
1058
+ <span class="hits">2</span>
1059
+
1060
+ <code class="ruby"> expect{url_decoding(Diversion::Decode::Json)}.to_not raise_error</code>
1061
+ </li>
1062
+
1063
+ <li class="never" data-hits="" data-linenumber="122">
1064
+
1065
+
1066
+ <code class="ruby"> end</code>
1067
+ </li>
1068
+
1069
+ <li class="covered" data-hits="1" data-linenumber="123">
1070
+ <span class="hits">1</span>
1071
+
1072
+ <code class="ruby"> it &quot;doesn't accept an invalid module&quot; do</code>
1073
+ </li>
1074
+
1075
+ <li class="covered" data-hits="2" data-linenumber="124">
1076
+ <span class="hits">2</span>
1077
+
1078
+ <code class="ruby"> expect{url_decoding(Diversion::Encode::Json)}.to raise_error</code>
1079
+ </li>
1080
+
1081
+ <li class="never" data-hits="" data-linenumber="125">
1082
+
1083
+
1084
+ <code class="ruby"> end</code>
1085
+ </li>
1086
+
1087
+ <li class="never" data-hits="" data-linenumber="126">
1088
+
1089
+
1090
+ <code class="ruby"> end</code>
1091
+ </li>
1092
+
1093
+ <li class="never" data-hits="" data-linenumber="127">
1094
+
1095
+
1096
+ <code class="ruby"></code>
1097
+ </li>
1098
+
1099
+ <li class="never" data-hits="" data-linenumber="128">
1100
+
1101
+
1102
+ <code class="ruby">end</code>
1103
+ </li>
1104
+
1105
+ </ol>
1106
+ </pre>
1107
+ </div>
1108
+
1109
+ <div class="source_table" id="e1a7fc5640c87fa6fa98ec90fa1b17c8ca87bf2e">
1110
+ <div class="header">
1111
+ <h3>decode/json_decode_spec.rb</h3>
1112
+ <h4><span class="green">100.0 %</span> covered</h4>
1113
+ <div>
1114
+ <b>46</b> relevant lines.
1115
+ <span class="green"><b>46</b> lines covered</span> and
1116
+ <span class="red"><b>0</b> lines missed.</span>
1117
+ </div>
1118
+ </div>
1119
+
1120
+ <pre>
1121
+ <ol>
1122
+
1123
+ <li class="covered" data-hits="1" data-linenumber="1">
1124
+ <span class="hits">1</span>
1125
+
1126
+ <code class="ruby">require &quot;spec_helper&quot;</code>
1127
+ </li>
1128
+
1129
+ <li class="never" data-hits="" data-linenumber="2">
1130
+
1131
+
1132
+ <code class="ruby"></code>
1133
+ </li>
1134
+
1135
+ <li class="covered" data-hits="1" data-linenumber="3">
1136
+ <span class="hits">1</span>
1137
+
1138
+ <code class="ruby">describe Diversion::Decode::Json do</code>
1139
+ </li>
1140
+
1141
+ <li class="never" data-hits="" data-linenumber="4">
1142
+
1143
+
1144
+ <code class="ruby"></code>
1145
+ </li>
1146
+
1147
+ <li class="covered" data-hits="1" data-linenumber="5">
1148
+ <span class="hits">1</span>
1149
+
1150
+ <code class="ruby"> include_context &quot;json&quot;</code>
1151
+ </li>
1152
+
1153
+ <li class="never" data-hits="" data-linenumber="6">
1154
+
1155
+
1156
+ <code class="ruby"></code>
1157
+ </li>
1158
+
1159
+ <li class="covered" data-hits="1" data-linenumber="7">
1160
+ <span class="hits">1</span>
1161
+
1162
+ <code class="ruby"> it &quot;returns correct type for non-signed&quot; do</code>
1163
+ </li>
1164
+
1165
+ <li class="covered" data-hits="1" data-linenumber="8">
1166
+ <span class="hits">1</span>
1167
+
1168
+ <code class="ruby"> expect(decode_json).to be_a Hash</code>
1169
+ </li>
1170
+
1171
+ <li class="never" data-hits="" data-linenumber="9">
1172
+
1173
+
1174
+ <code class="ruby"> end</code>
1175
+ </li>
1176
+
1177
+ <li class="never" data-hits="" data-linenumber="10">
1178
+
1179
+
1180
+ <code class="ruby"></code>
1181
+ </li>
1182
+
1183
+ <li class="covered" data-hits="1" data-linenumber="11">
1184
+ <span class="hits">1</span>
1185
+
1186
+ <code class="ruby"> it &quot;returns correct type for signed&quot; do</code>
1187
+ </li>
1188
+
1189
+ <li class="covered" data-hits="1" data-linenumber="12">
1190
+ <span class="hits">1</span>
1191
+
1192
+ <code class="ruby"> expect(decode_json_signed).to be_a Hash</code>
1193
+ </li>
1194
+
1195
+ <li class="never" data-hits="" data-linenumber="13">
1196
+
1197
+
1198
+ <code class="ruby"> end</code>
1199
+ </li>
1200
+
1201
+ <li class="never" data-hits="" data-linenumber="14">
1202
+
1203
+
1204
+ <code class="ruby"></code>
1205
+ </li>
1206
+
1207
+ <li class="covered" data-hits="1" data-linenumber="15">
1208
+ <span class="hits">1</span>
1209
+
1210
+ <code class="ruby"> it &quot;raises when data format invalid&quot; do</code>
1211
+ </li>
1212
+
1213
+ <li class="covered" data-hits="2" data-linenumber="16">
1214
+ <span class="hits">2</span>
1215
+
1216
+ <code class="ruby"> expect{client.decode(&quot;test-test-test&quot;)}.to raise_error(Diversion::Error::BadUrlDataFormat)</code>
1217
+ </li>
1218
+
1219
+ <li class="never" data-hits="" data-linenumber="17">
1220
+
1221
+
1222
+ <code class="ruby"> end</code>
1223
+ </li>
1224
+
1225
+ <li class="never" data-hits="" data-linenumber="18">
1226
+
1227
+
1228
+ <code class="ruby"></code>
1229
+ </li>
1230
+
1231
+ <li class="covered" data-hits="1" data-linenumber="19">
1232
+ <span class="hits">1</span>
1233
+
1234
+ <code class="ruby"> it &quot;doesn't parse when passed bad data&quot; do</code>
1235
+ </li>
1236
+
1237
+ <li class="covered" data-hits="1" data-linenumber="20">
1238
+ <span class="hits">1</span>
1239
+
1240
+ <code class="ruby"> expect(client.decode(&quot;test-test&quot;)[:parsed]).to be_false</code>
1241
+ </li>
1242
+
1243
+ <li class="never" data-hits="" data-linenumber="21">
1244
+
1245
+
1246
+ <code class="ruby"> end</code>
1247
+ </li>
1248
+
1249
+ <li class="never" data-hits="" data-linenumber="22">
1250
+
1251
+
1252
+ <code class="ruby"></code>
1253
+ </li>
1254
+
1255
+ <li class="covered" data-hits="1" data-linenumber="23">
1256
+ <span class="hits">1</span>
1257
+
1258
+ <code class="ruby"> it &quot;parses when passed good data&quot; do</code>
1259
+ </li>
1260
+
1261
+ <li class="covered" data-hits="1" data-linenumber="24">
1262
+ <span class="hits">1</span>
1263
+
1264
+ <code class="ruby"> expect(decode_json[:parsed]).to be_true</code>
1265
+ </li>
1266
+
1267
+ <li class="never" data-hits="" data-linenumber="25">
1268
+
1269
+
1270
+ <code class="ruby"> end</code>
1271
+ </li>
1272
+
1273
+ <li class="never" data-hits="" data-linenumber="26">
1274
+
1275
+
1276
+ <code class="ruby"></code>
1277
+ </li>
1278
+
1279
+ <li class="covered" data-hits="1" data-linenumber="27">
1280
+ <span class="hits">1</span>
1281
+
1282
+ <code class="ruby"> it &quot;returns expected values when passed good unsigned data&quot; do</code>
1283
+ </li>
1284
+
1285
+ <li class="covered" data-hits="1" data-linenumber="28">
1286
+ <span class="hits">1</span>
1287
+
1288
+ <code class="ruby"> hash = decode_json</code>
1289
+ </li>
1290
+
1291
+ <li class="covered" data-hits="1" data-linenumber="29">
1292
+ <span class="hits">1</span>
1293
+
1294
+ <code class="ruby"> expect(hash[:url]).to eq(&quot;http://test.com/test&quot;)</code>
1295
+ </li>
1296
+
1297
+ <li class="covered" data-hits="1" data-linenumber="30">
1298
+ <span class="hits">1</span>
1299
+
1300
+ <code class="ruby"> expect(hash[:signed]).to be_false</code>
1301
+ </li>
1302
+
1303
+ <li class="covered" data-hits="1" data-linenumber="31">
1304
+ <span class="hits">1</span>
1305
+
1306
+ <code class="ruby"> expect(hash[:key_presented]).to be_empty</code>
1307
+ </li>
1308
+
1309
+ <li class="covered" data-hits="1" data-linenumber="32">
1310
+ <span class="hits">1</span>
1311
+
1312
+ <code class="ruby"> expect(hash[:key_expected]).to be_empty</code>
1313
+ </li>
1314
+
1315
+ <li class="covered" data-hits="1" data-linenumber="33">
1316
+ <span class="hits">1</span>
1317
+
1318
+ <code class="ruby"> expect(hash[:key_verified]).to be_false</code>
1319
+ </li>
1320
+
1321
+ <li class="never" data-hits="" data-linenumber="34">
1322
+
1323
+
1324
+ <code class="ruby"> end</code>
1325
+ </li>
1326
+
1327
+ <li class="never" data-hits="" data-linenumber="35">
1328
+
1329
+
1330
+ <code class="ruby"></code>
1331
+ </li>
1332
+
1333
+ <li class="covered" data-hits="1" data-linenumber="36">
1334
+ <span class="hits">1</span>
1335
+
1336
+ <code class="ruby"> it &quot;returns expected values when passed good signed data&quot; do</code>
1337
+ </li>
1338
+
1339
+ <li class="covered" data-hits="1" data-linenumber="37">
1340
+ <span class="hits">1</span>
1341
+
1342
+ <code class="ruby"> hash = decode_json_signed</code>
1343
+ </li>
1344
+
1345
+ <li class="covered" data-hits="1" data-linenumber="38">
1346
+ <span class="hits">1</span>
1347
+
1348
+ <code class="ruby"> expect(hash[:url]).to eq(&quot;http://test.com/test&quot;)</code>
1349
+ </li>
1350
+
1351
+ <li class="covered" data-hits="1" data-linenumber="39">
1352
+ <span class="hits">1</span>
1353
+
1354
+ <code class="ruby"> expect(hash[:signed]).to be_true</code>
1355
+ </li>
1356
+
1357
+ <li class="covered" data-hits="1" data-linenumber="40">
1358
+ <span class="hits">1</span>
1359
+
1360
+ <code class="ruby"> expect(hash[:key_presented]).to eq(JSON_KEY)</code>
1361
+ </li>
1362
+
1363
+ <li class="covered" data-hits="1" data-linenumber="41">
1364
+ <span class="hits">1</span>
1365
+
1366
+ <code class="ruby"> expect(hash[:key_expected]).to eq(JSON_KEY)</code>
1367
+ </li>
1368
+
1369
+ <li class="covered" data-hits="1" data-linenumber="42">
1370
+ <span class="hits">1</span>
1371
+
1372
+ <code class="ruby"> expect(hash[:key_verified]).to be_true</code>
1373
+ </li>
1374
+
1375
+ <li class="never" data-hits="" data-linenumber="43">
1376
+
1377
+
1378
+ <code class="ruby"> end</code>
1379
+ </li>
1380
+
1381
+ <li class="never" data-hits="" data-linenumber="44">
1382
+
1383
+
1384
+ <code class="ruby"></code>
1385
+ </li>
1386
+
1387
+ <li class="covered" data-hits="1" data-linenumber="45">
1388
+ <span class="hits">1</span>
1389
+
1390
+ <code class="ruby"> it &quot;returns expected values when passed badly signed data&quot; do</code>
1391
+ </li>
1392
+
1393
+ <li class="covered" data-hits="1" data-linenumber="46">
1394
+ <span class="hits">1</span>
1395
+
1396
+ <code class="ruby"> hash = decode_json_bad_key</code>
1397
+ </li>
1398
+
1399
+ <li class="covered" data-hits="1" data-linenumber="47">
1400
+ <span class="hits">1</span>
1401
+
1402
+ <code class="ruby"> expect(hash[:url]).to eq(&quot;http://test.com/test&quot;)</code>
1403
+ </li>
1404
+
1405
+ <li class="covered" data-hits="1" data-linenumber="48">
1406
+ <span class="hits">1</span>
1407
+
1408
+ <code class="ruby"> expect(hash[:signed]).to be_true</code>
1409
+ </li>
1410
+
1411
+ <li class="covered" data-hits="1" data-linenumber="49">
1412
+ <span class="hits">1</span>
1413
+
1414
+ <code class="ruby"> expect(hash[:key_presented]).to eq(JSON_KEY_BAD)</code>
1415
+ </li>
1416
+
1417
+ <li class="covered" data-hits="1" data-linenumber="50">
1418
+ <span class="hits">1</span>
1419
+
1420
+ <code class="ruby"> expect(hash[:key_expected]).to eq(JSON_KEY)</code>
1421
+ </li>
1422
+
1423
+ <li class="covered" data-hits="1" data-linenumber="51">
1424
+ <span class="hits">1</span>
1425
+
1426
+ <code class="ruby"> expect(hash[:key_verified]).to be_false</code>
1427
+ </li>
1428
+
1429
+ <li class="never" data-hits="" data-linenumber="52">
1430
+
1431
+
1432
+ <code class="ruby"> end</code>
1433
+ </li>
1434
+
1435
+ <li class="never" data-hits="" data-linenumber="53">
1436
+
1437
+
1438
+ <code class="ruby"></code>
1439
+ </li>
1440
+
1441
+ <li class="covered" data-hits="1" data-linenumber="54">
1442
+ <span class="hits">1</span>
1443
+
1444
+ <code class="ruby"> it &quot;decodes parameters as expected&quot; do</code>
1445
+ </li>
1446
+
1447
+ <li class="covered" data-hits="1" data-linenumber="55">
1448
+ <span class="hits">1</span>
1449
+
1450
+ <code class="ruby"> enc = client.encode(HTML, {:b =&gt; 999})</code>
1451
+ </li>
1452
+
1453
+ <li class="covered" data-hits="1" data-linenumber="56">
1454
+ <span class="hits">1</span>
1455
+
1456
+ <code class="ruby"> data = enc.scan(/&quot;.*?\/.*?\/.*?\/(.*?)&quot;/).first.first</code>
1457
+ </li>
1458
+
1459
+ <li class="covered" data-hits="1" data-linenumber="57">
1460
+ <span class="hits">1</span>
1461
+
1462
+ <code class="ruby"> result = client.decode(data)</code>
1463
+ </li>
1464
+
1465
+ <li class="covered" data-hits="1" data-linenumber="58">
1466
+ <span class="hits">1</span>
1467
+
1468
+ <code class="ruby"> expect(result[:test]).to eq(&quot;1234&quot;)</code>
1469
+ </li>
1470
+
1471
+ <li class="covered" data-hits="1" data-linenumber="59">
1472
+ <span class="hits">1</span>
1473
+
1474
+ <code class="ruby"> expect(result[:b]).to eq(999)</code>
1475
+ </li>
1476
+
1477
+ <li class="never" data-hits="" data-linenumber="60">
1478
+
1479
+
1480
+ <code class="ruby"> end</code>
1481
+ </li>
1482
+
1483
+ <li class="never" data-hits="" data-linenumber="61">
1484
+
1485
+
1486
+ <code class="ruby"></code>
1487
+ </li>
1488
+
1489
+ <li class="covered" data-hits="1" data-linenumber="62">
1490
+ <span class="hits">1</span>
1491
+
1492
+ <code class="ruby"> it &quot;decodes parameters as expected when signed&quot; do</code>
1493
+ </li>
1494
+
1495
+ <li class="covered" data-hits="1" data-linenumber="63">
1496
+ <span class="hits">1</span>
1497
+
1498
+ <code class="ruby"> enc = client_sign.encode(HTML, {:b =&gt; 999})</code>
1499
+ </li>
1500
+
1501
+ <li class="covered" data-hits="1" data-linenumber="64">
1502
+ <span class="hits">1</span>
1503
+
1504
+ <code class="ruby"> data = enc.scan(/&quot;.*?\/.*?\/.*?\/(.*?)&quot;/).first.first</code>
1505
+ </li>
1506
+
1507
+ <li class="covered" data-hits="1" data-linenumber="65">
1508
+ <span class="hits">1</span>
1509
+
1510
+ <code class="ruby"> hash = client.decode(data)</code>
1511
+ </li>
1512
+
1513
+ <li class="covered" data-hits="1" data-linenumber="66">
1514
+ <span class="hits">1</span>
1515
+
1516
+ <code class="ruby"> expect(hash[:test]).to eq(&quot;1234&quot;)</code>
1517
+ </li>
1518
+
1519
+ <li class="covered" data-hits="1" data-linenumber="67">
1520
+ <span class="hits">1</span>
1521
+
1522
+ <code class="ruby"> expect(hash[:b]).to eq(999)</code>
1523
+ </li>
1524
+
1525
+ <li class="never" data-hits="" data-linenumber="68">
1526
+
1527
+
1528
+ <code class="ruby"> end</code>
1529
+ </li>
1530
+
1531
+ <li class="never" data-hits="" data-linenumber="69">
1532
+
1533
+
1534
+ <code class="ruby"></code>
1535
+ </li>
1536
+
1537
+ <li class="never" data-hits="" data-linenumber="70">
1538
+
1539
+
1540
+ <code class="ruby">end</code>
1541
+ </li>
1542
+
1543
+ </ol>
1544
+ </pre>
1545
+ </div>
1546
+
1547
+ <div class="source_table" id="fd74014db3bf2e13efedbd4af51ffd71e795c880">
1548
+ <div class="header">
1549
+ <h3>decode/params_decode_spec.rb</h3>
1550
+ <h4><span class="green">100.0 %</span> covered</h4>
1551
+ <div>
1552
+ <b>48</b> relevant lines.
1553
+ <span class="green"><b>48</b> lines covered</span> and
1554
+ <span class="red"><b>0</b> lines missed.</span>
1555
+ </div>
1556
+ </div>
1557
+
1558
+ <pre>
1559
+ <ol>
1560
+
1561
+ <li class="covered" data-hits="1" data-linenumber="1">
1562
+ <span class="hits">1</span>
1563
+
1564
+ <code class="ruby">require &quot;spec_helper&quot;</code>
1565
+ </li>
1566
+
1567
+ <li class="never" data-hits="" data-linenumber="2">
1568
+
1569
+
1570
+ <code class="ruby"></code>
1571
+ </li>
1572
+
1573
+ <li class="covered" data-hits="1" data-linenumber="3">
1574
+ <span class="hits">1</span>
1575
+
1576
+ <code class="ruby">describe Diversion::Decode::Params do</code>
1577
+ </li>
1578
+
1579
+ <li class="never" data-hits="" data-linenumber="4">
1580
+
1581
+
1582
+ <code class="ruby"></code>
1583
+ </li>
1584
+
1585
+ <li class="covered" data-hits="1" data-linenumber="5">
1586
+ <span class="hits">1</span>
1587
+
1588
+ <code class="ruby"> include_context &quot;params&quot;</code>
1589
+ </li>
1590
+
1591
+ <li class="never" data-hits="" data-linenumber="6">
1592
+
1593
+
1594
+ <code class="ruby"></code>
1595
+ </li>
1596
+
1597
+ <li class="covered" data-hits="1" data-linenumber="7">
1598
+ <span class="hits">1</span>
1599
+
1600
+ <code class="ruby"> it &quot;returns correct type for non-signed&quot; do</code>
1601
+ </li>
1602
+
1603
+ <li class="covered" data-hits="1" data-linenumber="8">
1604
+ <span class="hits">1</span>
1605
+
1606
+ <code class="ruby"> expect(decode_params).to be_a Hash</code>
1607
+ </li>
1608
+
1609
+ <li class="never" data-hits="" data-linenumber="9">
1610
+
1611
+
1612
+ <code class="ruby"> end</code>
1613
+ </li>
1614
+
1615
+ <li class="never" data-hits="" data-linenumber="10">
1616
+
1617
+
1618
+ <code class="ruby"></code>
1619
+ </li>
1620
+
1621
+ <li class="covered" data-hits="1" data-linenumber="11">
1622
+ <span class="hits">1</span>
1623
+
1624
+ <code class="ruby"> it &quot;returns correct type for signed&quot; do</code>
1625
+ </li>
1626
+
1627
+ <li class="covered" data-hits="1" data-linenumber="12">
1628
+ <span class="hits">1</span>
1629
+
1630
+ <code class="ruby"> expect(decode_params_signed).to be_a Hash</code>
1631
+ </li>
1632
+
1633
+ <li class="never" data-hits="" data-linenumber="13">
1634
+
1635
+
1636
+ <code class="ruby"> end</code>
1637
+ </li>
1638
+
1639
+ <li class="never" data-hits="" data-linenumber="14">
1640
+
1641
+
1642
+ <code class="ruby"></code>
1643
+ </li>
1644
+
1645
+ <li class="covered" data-hits="1" data-linenumber="15">
1646
+ <span class="hits">1</span>
1647
+
1648
+ <code class="ruby"> it &quot;raises when data format invalid&quot; do</code>
1649
+ </li>
1650
+
1651
+ <li class="covered" data-hits="2" data-linenumber="16">
1652
+ <span class="hits">2</span>
1653
+
1654
+ <code class="ruby"> expect{client.decode(&quot;badparam=badvalue&quot;)}.to raise_error(Diversion::Error::BadUrlDataFormat)</code>
1655
+ </li>
1656
+
1657
+ <li class="never" data-hits="" data-linenumber="17">
1658
+
1659
+
1660
+ <code class="ruby"> end</code>
1661
+ </li>
1662
+
1663
+ <li class="never" data-hits="" data-linenumber="18">
1664
+
1665
+
1666
+ <code class="ruby"></code>
1667
+ </li>
1668
+
1669
+ <li class="covered" data-hits="1" data-linenumber="19">
1670
+ <span class="hits">1</span>
1671
+
1672
+ <code class="ruby"> it &quot;raises when data format invalid&quot; do</code>
1673
+ </li>
1674
+
1675
+ <li class="covered" data-hits="2" data-linenumber="20">
1676
+ <span class="hits">2</span>
1677
+
1678
+ <code class="ruby"> expect{client.decode(&quot;rubbish&quot;)}.to raise_error(Diversion::Error::BadUrlDataFormat)</code>
1679
+ </li>
1680
+
1681
+ <li class="never" data-hits="" data-linenumber="21">
1682
+
1683
+
1684
+ <code class="ruby"> end</code>
1685
+ </li>
1686
+
1687
+ <li class="never" data-hits="" data-linenumber="22">
1688
+
1689
+
1690
+ <code class="ruby"></code>
1691
+ </li>
1692
+
1693
+ <li class="covered" data-hits="1" data-linenumber="23">
1694
+ <span class="hits">1</span>
1695
+
1696
+ <code class="ruby"> it &quot;raises when missing url data parameter&quot; do</code>
1697
+ </li>
1698
+
1699
+ <li class="covered" data-hits="2" data-linenumber="24">
1700
+ <span class="hits">2</span>
1701
+
1702
+ <code class="ruby"> expect{client.decode(&quot;d=#{CGI::escape('badparam=badvalue')}&quot;)}.to raise_error(Diversion::Error::BadUrlDataFormat)</code>
1703
+ </li>
1704
+
1705
+ <li class="never" data-hits="" data-linenumber="25">
1706
+
1707
+
1708
+ <code class="ruby"> end</code>
1709
+ </li>
1710
+
1711
+ <li class="never" data-hits="" data-linenumber="26">
1712
+
1713
+
1714
+ <code class="ruby"></code>
1715
+ </li>
1716
+
1717
+ <li class="covered" data-hits="1" data-linenumber="27">
1718
+ <span class="hits">1</span>
1719
+
1720
+ <code class="ruby"> it &quot;raises when missing url data parameter empty&quot; do</code>
1721
+ </li>
1722
+
1723
+ <li class="covered" data-hits="2" data-linenumber="28">
1724
+ <span class="hits">2</span>
1725
+
1726
+ <code class="ruby"> expect{client.decode(&quot;d=#{CGI::escape('url=')}&quot;)}.to raise_error(Diversion::Error::BadUrlDataFormat)</code>
1727
+ </li>
1728
+
1729
+ <li class="never" data-hits="" data-linenumber="29">
1730
+
1731
+
1732
+ <code class="ruby"> end</code>
1733
+ </li>
1734
+
1735
+ <li class="never" data-hits="" data-linenumber="30">
1736
+
1737
+
1738
+ <code class="ruby"></code>
1739
+ </li>
1740
+
1741
+ <li class="covered" data-hits="1" data-linenumber="31">
1742
+ <span class="hits">1</span>
1743
+
1744
+ <code class="ruby"> it &quot;returns expected values when passed good unsigned data&quot; do</code>
1745
+ </li>
1746
+
1747
+ <li class="covered" data-hits="1" data-linenumber="32">
1748
+ <span class="hits">1</span>
1749
+
1750
+ <code class="ruby"> hash = decode_params</code>
1751
+ </li>
1752
+
1753
+ <li class="covered" data-hits="1" data-linenumber="33">
1754
+ <span class="hits">1</span>
1755
+
1756
+ <code class="ruby"> expect(hash[:url]).to eq(&quot;http://test.com/test&quot;)</code>
1757
+ </li>
1758
+
1759
+ <li class="covered" data-hits="1" data-linenumber="34">
1760
+ <span class="hits">1</span>
1761
+
1762
+ <code class="ruby"> expect(hash[:signed]).to be_false</code>
1763
+ </li>
1764
+
1765
+ <li class="covered" data-hits="1" data-linenumber="35">
1766
+ <span class="hits">1</span>
1767
+
1768
+ <code class="ruby"> expect(hash[:key_presented]).to be_empty</code>
1769
+ </li>
1770
+
1771
+ <li class="covered" data-hits="1" data-linenumber="36">
1772
+ <span class="hits">1</span>
1773
+
1774
+ <code class="ruby"> expect(hash[:key_expected]).to be_empty</code>
1775
+ </li>
1776
+
1777
+ <li class="covered" data-hits="1" data-linenumber="37">
1778
+ <span class="hits">1</span>
1779
+
1780
+ <code class="ruby"> expect(hash[:key_verified]).to be_false</code>
1781
+ </li>
1782
+
1783
+ <li class="never" data-hits="" data-linenumber="38">
1784
+
1785
+
1786
+ <code class="ruby"> end</code>
1787
+ </li>
1788
+
1789
+ <li class="never" data-hits="" data-linenumber="39">
1790
+
1791
+
1792
+ <code class="ruby"></code>
1793
+ </li>
1794
+
1795
+ <li class="covered" data-hits="1" data-linenumber="40">
1796
+ <span class="hits">1</span>
1797
+
1798
+ <code class="ruby"> it &quot;returns expected values when passed good signed data&quot; do</code>
1799
+ </li>
1800
+
1801
+ <li class="covered" data-hits="1" data-linenumber="41">
1802
+ <span class="hits">1</span>
1803
+
1804
+ <code class="ruby"> hash = decode_params_signed</code>
1805
+ </li>
1806
+
1807
+ <li class="covered" data-hits="1" data-linenumber="42">
1808
+ <span class="hits">1</span>
1809
+
1810
+ <code class="ruby"> expect(hash[:url]).to eq(&quot;http://test.com/test&quot;)</code>
1811
+ </li>
1812
+
1813
+ <li class="covered" data-hits="1" data-linenumber="43">
1814
+ <span class="hits">1</span>
1815
+
1816
+ <code class="ruby"> expect(hash[:signed]).to be_true</code>
1817
+ </li>
1818
+
1819
+ <li class="covered" data-hits="1" data-linenumber="44">
1820
+ <span class="hits">1</span>
1821
+
1822
+ <code class="ruby"> expect(hash[:key_presented]).to eq(PARAMS_KEY)</code>
1823
+ </li>
1824
+
1825
+ <li class="covered" data-hits="1" data-linenumber="45">
1826
+ <span class="hits">1</span>
1827
+
1828
+ <code class="ruby"> expect(hash[:key_expected]).to eq(PARAMS_KEY)</code>
1829
+ </li>
1830
+
1831
+ <li class="covered" data-hits="1" data-linenumber="46">
1832
+ <span class="hits">1</span>
1833
+
1834
+ <code class="ruby"> expect(hash[:key_verified]).to be_true</code>
1835
+ </li>
1836
+
1837
+ <li class="never" data-hits="" data-linenumber="47">
1838
+
1839
+
1840
+ <code class="ruby"> end</code>
1841
+ </li>
1842
+
1843
+ <li class="never" data-hits="" data-linenumber="48">
1844
+
1845
+
1846
+ <code class="ruby"></code>
1847
+ </li>
1848
+
1849
+ <li class="covered" data-hits="1" data-linenumber="49">
1850
+ <span class="hits">1</span>
1851
+
1852
+ <code class="ruby"> it &quot;returns expected values when passed badly signed data&quot; do</code>
1853
+ </li>
1854
+
1855
+ <li class="covered" data-hits="1" data-linenumber="50">
1856
+ <span class="hits">1</span>
1857
+
1858
+ <code class="ruby"> hash = decode_params_bad_key</code>
1859
+ </li>
1860
+
1861
+ <li class="covered" data-hits="1" data-linenumber="51">
1862
+ <span class="hits">1</span>
1863
+
1864
+ <code class="ruby"> expect(hash[:url]).to eq(&quot;http://test.com/test&quot;)</code>
1865
+ </li>
1866
+
1867
+ <li class="covered" data-hits="1" data-linenumber="52">
1868
+ <span class="hits">1</span>
1869
+
1870
+ <code class="ruby"> expect(hash[:signed]).to be_true</code>
1871
+ </li>
1872
+
1873
+ <li class="covered" data-hits="1" data-linenumber="53">
1874
+ <span class="hits">1</span>
1875
+
1876
+ <code class="ruby"> expect(hash[:key_presented]).to eq(PARAMS_KEY_BAD)</code>
1877
+ </li>
1878
+
1879
+ <li class="covered" data-hits="1" data-linenumber="54">
1880
+ <span class="hits">1</span>
1881
+
1882
+ <code class="ruby"> expect(hash[:key_expected]).to eq(PARAMS_KEY)</code>
1883
+ </li>
1884
+
1885
+ <li class="covered" data-hits="1" data-linenumber="55">
1886
+ <span class="hits">1</span>
1887
+
1888
+ <code class="ruby"> expect(hash[:key_verified]).to be_false</code>
1889
+ </li>
1890
+
1891
+ <li class="never" data-hits="" data-linenumber="56">
1892
+
1893
+
1894
+ <code class="ruby"> end</code>
1895
+ </li>
1896
+
1897
+ <li class="never" data-hits="" data-linenumber="57">
1898
+
1899
+
1900
+ <code class="ruby"></code>
1901
+ </li>
1902
+
1903
+ <li class="covered" data-hits="1" data-linenumber="58">
1904
+ <span class="hits">1</span>
1905
+
1906
+ <code class="ruby"> it &quot;decodes parameters as expected&quot; do</code>
1907
+ </li>
1908
+
1909
+ <li class="covered" data-hits="1" data-linenumber="59">
1910
+ <span class="hits">1</span>
1911
+
1912
+ <code class="ruby"> enc = client.encode(HTML, {:b =&gt; 999})</code>
1913
+ </li>
1914
+
1915
+ <li class="covered" data-hits="1" data-linenumber="60">
1916
+ <span class="hits">1</span>
1917
+
1918
+ <code class="ruby"> data = enc.scan(/&quot;.*?\/.*?\/.*?\/(.*?)&quot;/).first.first[1..-1]</code>
1919
+ </li>
1920
+
1921
+ <li class="covered" data-hits="1" data-linenumber="61">
1922
+ <span class="hits">1</span>
1923
+
1924
+ <code class="ruby"> result = client.decode(data)</code>
1925
+ </li>
1926
+
1927
+ <li class="covered" data-hits="1" data-linenumber="62">
1928
+ <span class="hits">1</span>
1929
+
1930
+ <code class="ruby"> expect(result[:test]).to eq(&quot;1234&quot;)</code>
1931
+ </li>
1932
+
1933
+ <li class="covered" data-hits="1" data-linenumber="63">
1934
+ <span class="hits">1</span>
1935
+
1936
+ <code class="ruby"> expect(result[:b]).to eq(&quot;999&quot;)</code>
1937
+ </li>
1938
+
1939
+ <li class="never" data-hits="" data-linenumber="64">
1940
+
1941
+
1942
+ <code class="ruby"> end</code>
1943
+ </li>
1944
+
1945
+ <li class="never" data-hits="" data-linenumber="65">
1946
+
1947
+
1948
+ <code class="ruby"></code>
1949
+ </li>
1950
+
1951
+ <li class="covered" data-hits="1" data-linenumber="66">
1952
+ <span class="hits">1</span>
1953
+
1954
+ <code class="ruby"> it &quot;decodes parameters as expected when signed&quot; do</code>
1955
+ </li>
1956
+
1957
+ <li class="covered" data-hits="1" data-linenumber="67">
1958
+ <span class="hits">1</span>
1959
+
1960
+ <code class="ruby"> enc = client_sign.encode(HTML, {:b =&gt; 999})</code>
1961
+ </li>
1962
+
1963
+ <li class="covered" data-hits="1" data-linenumber="68">
1964
+ <span class="hits">1</span>
1965
+
1966
+ <code class="ruby"> data = enc.scan(/&quot;.*?\/.*?\/.*?\/(.*?)&quot;/).first.first[1..-1]</code>
1967
+ </li>
1968
+
1969
+ <li class="covered" data-hits="1" data-linenumber="69">
1970
+ <span class="hits">1</span>
1971
+
1972
+ <code class="ruby"> hash = client.decode(data)</code>
1973
+ </li>
1974
+
1975
+ <li class="covered" data-hits="1" data-linenumber="70">
1976
+ <span class="hits">1</span>
1977
+
1978
+ <code class="ruby"> expect(hash[:test]).to eq(&quot;1234&quot;)</code>
1979
+ </li>
1980
+
1981
+ <li class="covered" data-hits="1" data-linenumber="71">
1982
+ <span class="hits">1</span>
1983
+
1984
+ <code class="ruby"> expect(hash[:b]).to eq(&quot;999&quot;)</code>
1985
+ </li>
1986
+
1987
+ <li class="never" data-hits="" data-linenumber="72">
1988
+
1989
+
1990
+ <code class="ruby"> end</code>
1991
+ </li>
1992
+
1993
+ <li class="never" data-hits="" data-linenumber="73">
1994
+
1995
+
1996
+ <code class="ruby"></code>
1997
+ </li>
1998
+
1999
+ <li class="never" data-hits="" data-linenumber="74">
2000
+
2001
+
2002
+ <code class="ruby">end</code>
2003
+ </li>
2004
+
2005
+ </ol>
2006
+ </pre>
2007
+ </div>
2008
+
2009
+ <div class="source_table" id="a52e7c4b683842302e76abc21d83ef3b7dc89685">
2010
+ <div class="header">
2011
+ <h3>decode_spec.rb</h3>
2012
+ <h4><span class="green">100.0 %</span> covered</h4>
2013
+ <div>
2014
+ <b>5</b> relevant lines.
2015
+ <span class="green"><b>5</b> lines covered</span> and
2016
+ <span class="red"><b>0</b> lines missed.</span>
2017
+ </div>
2018
+ </div>
2019
+
2020
+ <pre>
2021
+ <ol>
2022
+
2023
+ <li class="covered" data-hits="1" data-linenumber="1">
2024
+ <span class="hits">1</span>
2025
+
2026
+ <code class="ruby">require &quot;spec_helper&quot;</code>
2027
+ </li>
2028
+
2029
+ <li class="never" data-hits="" data-linenumber="2">
2030
+
2031
+
2032
+ <code class="ruby"></code>
2033
+ </li>
2034
+
2035
+ <li class="covered" data-hits="1" data-linenumber="3">
2036
+ <span class="hits">1</span>
2037
+
2038
+ <code class="ruby">describe Diversion::Decode do</code>
2039
+ </li>
2040
+
2041
+ <li class="never" data-hits="" data-linenumber="4">
2042
+
2043
+
2044
+ <code class="ruby"></code>
2045
+ </li>
2046
+
2047
+ <li class="never" data-hits="" data-linenumber="5">
2048
+
2049
+
2050
+ <code class="ruby"> # we use json encoding here but it doesn't matter as we're testing common functionality</code>
2051
+ </li>
2052
+
2053
+ <li class="covered" data-hits="1" data-linenumber="6">
2054
+ <span class="hits">1</span>
2055
+
2056
+ <code class="ruby"> include_context &quot;json&quot;</code>
2057
+ </li>
2058
+
2059
+ <li class="never" data-hits="" data-linenumber="7">
2060
+
2061
+
2062
+ <code class="ruby"> </code>
2063
+ </li>
2064
+
2065
+ <li class="covered" data-hits="1" data-linenumber="8">
2066
+ <span class="hits">1</span>
2067
+
2068
+ <code class="ruby"> it &quot;raise ArgumentError if data.length == 0&quot; do</code>
2069
+ </li>
2070
+
2071
+ <li class="covered" data-hits="2" data-linenumber="9">
2072
+ <span class="hits">2</span>
2073
+
2074
+ <code class="ruby"> expect{client.decode(&quot;&quot;)}.to raise_error(ArgumentError)</code>
2075
+ </li>
2076
+
2077
+ <li class="never" data-hits="" data-linenumber="10">
2078
+
2079
+
2080
+ <code class="ruby"> end</code>
2081
+ </li>
2082
+
2083
+ <li class="never" data-hits="" data-linenumber="11">
2084
+
2085
+
2086
+ <code class="ruby"></code>
2087
+ </li>
2088
+
2089
+ <li class="never" data-hits="" data-linenumber="12">
2090
+
2091
+
2092
+ <code class="ruby">end</code>
2093
+ </li>
2094
+
2095
+ </ol>
2096
+ </pre>
2097
+ </div>
2098
+
2099
+ <div class="source_table" id="785b6692db21b24fc9fc8523d4eda0718b9dfa49">
2100
+ <div class="header">
2101
+ <h3>encode_spec.rb</h3>
2102
+ <h4><span class="green">100.0 %</span> covered</h4>
2103
+ <div>
2104
+ <b>15</b> relevant lines.
2105
+ <span class="green"><b>15</b> lines covered</span> and
2106
+ <span class="red"><b>0</b> lines missed.</span>
2107
+ </div>
2108
+ </div>
2109
+
2110
+ <pre>
2111
+ <ol>
2112
+
2113
+ <li class="covered" data-hits="1" data-linenumber="1">
2114
+ <span class="hits">1</span>
2115
+
2116
+ <code class="ruby">require &quot;spec_helper&quot;</code>
2117
+ </li>
2118
+
2119
+ <li class="never" data-hits="" data-linenumber="2">
2120
+
2121
+
2122
+ <code class="ruby"></code>
2123
+ </li>
2124
+
2125
+ <li class="covered" data-hits="1" data-linenumber="3">
2126
+ <span class="hits">1</span>
2127
+
2128
+ <code class="ruby">describe Diversion::Encode do</code>
2129
+ </li>
2130
+
2131
+ <li class="never" data-hits="" data-linenumber="4">
2132
+
2133
+
2134
+ <code class="ruby"></code>
2135
+ </li>
2136
+
2137
+ <li class="never" data-hits="" data-linenumber="5">
2138
+
2139
+
2140
+ <code class="ruby"> # we use json encoding here but it doesn't matter as we're testing common functionality</code>
2141
+ </li>
2142
+
2143
+ <li class="covered" data-hits="1" data-linenumber="6">
2144
+ <span class="hits">1</span>
2145
+
2146
+ <code class="ruby"> include_context &quot;json&quot;</code>
2147
+ </li>
2148
+
2149
+ <li class="never" data-hits="" data-linenumber="7">
2150
+
2151
+
2152
+ <code class="ruby"> </code>
2153
+ </li>
2154
+
2155
+ <li class="covered" data-hits="1" data-linenumber="8">
2156
+ <span class="hits">1</span>
2157
+
2158
+ <code class="ruby"> it &quot;ignores non-http uris&quot; do</code>
2159
+ </li>
2160
+
2161
+ <li class="covered" data-hits="1" data-linenumber="9">
2162
+ <span class="hits">1</span>
2163
+
2164
+ <code class="ruby"> expect(encode_email).to include('mailto:jess@doesnotexist.domain')</code>
2165
+ </li>
2166
+
2167
+ <li class="never" data-hits="" data-linenumber="10">
2168
+
2169
+
2170
+ <code class="ruby"> end</code>
2171
+ </li>
2172
+
2173
+ <li class="never" data-hits="" data-linenumber="11">
2174
+
2175
+
2176
+ <code class="ruby"></code>
2177
+ </li>
2178
+
2179
+ <li class="covered" data-hits="1" data-linenumber="12">
2180
+ <span class="hits">1</span>
2181
+
2182
+ <code class="ruby"> it &quot;converts http uris&quot; do</code>
2183
+ </li>
2184
+
2185
+ <li class="covered" data-hits="1" data-linenumber="13">
2186
+ <span class="hits">1</span>
2187
+
2188
+ <code class="ruby"> expect(encode_email).to_not include('https://twitter.com/intent/tweet?in_reply_to=51113028241989632')</code>
2189
+ </li>
2190
+
2191
+ <li class="never" data-hits="" data-linenumber="14">
2192
+
2193
+
2194
+ <code class="ruby"> end</code>
2195
+ </li>
2196
+
2197
+ <li class="never" data-hits="" data-linenumber="15">
2198
+
2199
+
2200
+ <code class="ruby"></code>
2201
+ </li>
2202
+
2203
+ <li class="covered" data-hits="1" data-linenumber="16">
2204
+ <span class="hits">1</span>
2205
+
2206
+ <code class="ruby"> it &quot;removes data attributes&quot; do</code>
2207
+ </li>
2208
+
2209
+ <li class="covered" data-hits="1" data-linenumber="17">
2210
+ <span class="hits">1</span>
2211
+
2212
+ <code class="ruby"> expect(encode_email).to_not include('data-')</code>
2213
+ </li>
2214
+
2215
+ <li class="never" data-hits="" data-linenumber="18">
2216
+
2217
+
2218
+ <code class="ruby"> end</code>
2219
+ </li>
2220
+
2221
+ <li class="never" data-hits="" data-linenumber="19">
2222
+
2223
+
2224
+ <code class="ruby"></code>
2225
+ </li>
2226
+
2227
+ <li class="covered" data-hits="1" data-linenumber="20">
2228
+ <span class="hits">1</span>
2229
+
2230
+ <code class="ruby"> it &quot;raises when signing key not set&quot; do</code>
2231
+ </li>
2232
+
2233
+ <li class="covered" data-hits="1" data-linenumber="21">
2234
+ <span class="hits">1</span>
2235
+
2236
+ <code class="ruby"> client_sign.sign_key = nil</code>
2237
+ </li>
2238
+
2239
+ <li class="covered" data-hits="2" data-linenumber="22">
2240
+ <span class="hits">2</span>
2241
+
2242
+ <code class="ruby"> expect { encode_json_html_signed }.to raise_error(Diversion::Error::KeyMissingError)</code>
2243
+ </li>
2244
+
2245
+ <li class="never" data-hits="" data-linenumber="23">
2246
+
2247
+
2248
+ <code class="ruby"> end</code>
2249
+ </li>
2250
+
2251
+ <li class="never" data-hits="" data-linenumber="24">
2252
+
2253
+
2254
+ <code class="ruby"></code>
2255
+ </li>
2256
+
2257
+ <li class="covered" data-hits="1" data-linenumber="25">
2258
+ <span class="hits">1</span>
2259
+
2260
+ <code class="ruby"> it &quot;raises when no uris defined&quot; do</code>
2261
+ </li>
2262
+
2263
+ <li class="covered" data-hits="1" data-linenumber="26">
2264
+ <span class="hits">1</span>
2265
+
2266
+ <code class="ruby"> client.encode_uris = []</code>
2267
+ </li>
2268
+
2269
+ <li class="covered" data-hits="2" data-linenumber="27">
2270
+ <span class="hits">2</span>
2271
+
2272
+ <code class="ruby"> expect { encode_json_html_signed }.to raise_error(Diversion::Error::UriMissingError)</code>
2273
+ </li>
2274
+
2275
+ <li class="never" data-hits="" data-linenumber="28">
2276
+
2277
+
2278
+ <code class="ruby"> end</code>
2279
+ </li>
2280
+
2281
+ <li class="never" data-hits="" data-linenumber="29">
2282
+
2283
+
2284
+ <code class="ruby"></code>
2285
+ </li>
2286
+
2287
+ <li class="never" data-hits="" data-linenumber="30">
2288
+
2289
+
2290
+ <code class="ruby">end</code>
2291
+ </li>
2292
+
2293
+ </ol>
2294
+ </pre>
2295
+ </div>
2296
+
2297
+ <div class="source_table" id="ae9421f4607208f7c70b12e66586cdc415b7a355">
2298
+ <div class="header">
2299
+ <h3>json_encode_spec.rb</h3>
2300
+ <h4><span class="green">100.0 %</span> covered</h4>
2301
+ <div>
2302
+ <b>21</b> relevant lines.
2303
+ <span class="green"><b>21</b> lines covered</span> and
2304
+ <span class="red"><b>0</b> lines missed.</span>
2305
+ </div>
2306
+ </div>
2307
+
2308
+ <pre>
2309
+ <ol>
2310
+
2311
+ <li class="covered" data-hits="1" data-linenumber="1">
2312
+ <span class="hits">1</span>
2313
+
2314
+ <code class="ruby">require &quot;spec_helper&quot;</code>
2315
+ </li>
2316
+
2317
+ <li class="never" data-hits="" data-linenumber="2">
2318
+
2319
+
2320
+ <code class="ruby"></code>
2321
+ </li>
2322
+
2323
+ <li class="covered" data-hits="1" data-linenumber="3">
2324
+ <span class="hits">1</span>
2325
+
2326
+ <code class="ruby">describe Diversion::Encode::Json do</code>
2327
+ </li>
2328
+
2329
+ <li class="never" data-hits="" data-linenumber="4">
2330
+
2331
+
2332
+ <code class="ruby"></code>
2333
+ </li>
2334
+
2335
+ <li class="covered" data-hits="1" data-linenumber="5">
2336
+ <span class="hits">1</span>
2337
+
2338
+ <code class="ruby"> include_context &quot;json&quot;</code>
2339
+ </li>
2340
+
2341
+ <li class="never" data-hits="" data-linenumber="6">
2342
+
2343
+
2344
+ <code class="ruby"></code>
2345
+ </li>
2346
+
2347
+ <li class="covered" data-hits="1" data-linenumber="7">
2348
+ <span class="hits">1</span>
2349
+
2350
+ <code class="ruby"> it &quot;returns correct type&quot; do</code>
2351
+ </li>
2352
+
2353
+ <li class="covered" data-hits="1" data-linenumber="8">
2354
+ <span class="hits">1</span>
2355
+
2356
+ <code class="ruby"> expect(encode_email).to be_a String</code>
2357
+ </li>
2358
+
2359
+ <li class="never" data-hits="" data-linenumber="9">
2360
+
2361
+
2362
+ <code class="ruby"> end</code>
2363
+ </li>
2364
+
2365
+ <li class="never" data-hits="" data-linenumber="10">
2366
+
2367
+
2368
+ <code class="ruby"></code>
2369
+ </li>
2370
+
2371
+ <li class="covered" data-hits="1" data-linenumber="11">
2372
+ <span class="hits">1</span>
2373
+
2374
+ <code class="ruby"> it &quot;uses correct path&quot; do</code>
2375
+ </li>
2376
+
2377
+ <li class="covered" data-hits="1" data-linenumber="12">
2378
+ <span class="hits">1</span>
2379
+
2380
+ <code class="ruby"> expect(encode_json_html).to eq(html_json_encoded)</code>
2381
+ </li>
2382
+
2383
+ <li class="never" data-hits="" data-linenumber="13">
2384
+
2385
+
2386
+ <code class="ruby"> end</code>
2387
+ </li>
2388
+
2389
+ <li class="never" data-hits="" data-linenumber="14">
2390
+
2391
+
2392
+ <code class="ruby"></code>
2393
+ </li>
2394
+
2395
+ <li class="covered" data-hits="1" data-linenumber="15">
2396
+ <span class="hits">1</span>
2397
+
2398
+ <code class="ruby"> it &quot;doesn't add port for 80&quot; do</code>
2399
+ </li>
2400
+
2401
+ <li class="covered" data-hits="1" data-linenumber="16">
2402
+ <span class="hits">1</span>
2403
+
2404
+ <code class="ruby"> client.port = 80</code>
2405
+ </li>
2406
+
2407
+ <li class="covered" data-hits="1" data-linenumber="17">
2408
+ <span class="hits">1</span>
2409
+
2410
+ <code class="ruby"> expect(encode_json_html).to eq(html_json_encoded)</code>
2411
+ </li>
2412
+
2413
+ <li class="never" data-hits="" data-linenumber="18">
2414
+
2415
+
2416
+ <code class="ruby"> end</code>
2417
+ </li>
2418
+
2419
+ <li class="never" data-hits="" data-linenumber="19">
2420
+
2421
+
2422
+ <code class="ruby"> </code>
2423
+ </li>
2424
+
2425
+ <li class="covered" data-hits="1" data-linenumber="20">
2426
+ <span class="hits">1</span>
2427
+
2428
+ <code class="ruby"> it &quot;adds port number for non-80 port&quot; do</code>
2429
+ </li>
2430
+
2431
+ <li class="covered" data-hits="1" data-linenumber="21">
2432
+ <span class="hits">1</span>
2433
+
2434
+ <code class="ruby"> client.port = 81</code>
2435
+ </li>
2436
+
2437
+ <li class="covered" data-hits="1" data-linenumber="22">
2438
+ <span class="hits">1</span>
2439
+
2440
+ <code class="ruby"> expect(encode_json_html).to eq(html_json_encoded({:port =&gt; 81}))</code>
2441
+ </li>
2442
+
2443
+ <li class="never" data-hits="" data-linenumber="23">
2444
+
2445
+
2446
+ <code class="ruby"> end</code>
2447
+ </li>
2448
+
2449
+ <li class="never" data-hits="" data-linenumber="24">
2450
+
2451
+
2452
+ <code class="ruby"></code>
2453
+ </li>
2454
+
2455
+ <li class="covered" data-hits="1" data-linenumber="25">
2456
+ <span class="hits">1</span>
2457
+
2458
+ <code class="ruby"> it &quot;doesn't sign by default&quot; do</code>
2459
+ </li>
2460
+
2461
+ <li class="covered" data-hits="1" data-linenumber="26">
2462
+ <span class="hits">1</span>
2463
+
2464
+ <code class="ruby"> expect(encode_json_html).to eq(html_json_encoded)</code>
2465
+ </li>
2466
+
2467
+ <li class="never" data-hits="" data-linenumber="27">
2468
+
2469
+
2470
+ <code class="ruby"> end</code>
2471
+ </li>
2472
+
2473
+ <li class="never" data-hits="" data-linenumber="28">
2474
+
2475
+
2476
+ <code class="ruby"></code>
2477
+ </li>
2478
+
2479
+ <li class="covered" data-hits="1" data-linenumber="29">
2480
+ <span class="hits">1</span>
2481
+
2482
+ <code class="ruby"> it &quot;signs correctly&quot; do</code>
2483
+ </li>
2484
+
2485
+ <li class="covered" data-hits="1" data-linenumber="30">
2486
+ <span class="hits">1</span>
2487
+
2488
+ <code class="ruby"> client_sign.sign_length = 32</code>
2489
+ </li>
2490
+
2491
+ <li class="covered" data-hits="1" data-linenumber="31">
2492
+ <span class="hits">1</span>
2493
+
2494
+ <code class="ruby"> expect(encode_json_html_signed).to eq(html_json_encoded({:sign_length =&gt; DEFAULT_SIGN_LEN}) )</code>
2495
+ </li>
2496
+
2497
+ <li class="never" data-hits="" data-linenumber="32">
2498
+
2499
+
2500
+ <code class="ruby"> end</code>
2501
+ </li>
2502
+
2503
+ <li class="never" data-hits="" data-linenumber="33">
2504
+
2505
+
2506
+ <code class="ruby"></code>
2507
+ </li>
2508
+
2509
+ <li class="covered" data-hits="1" data-linenumber="34">
2510
+ <span class="hits">1</span>
2511
+
2512
+ <code class="ruby"> it &quot;observes sign_length&quot; do</code>
2513
+ </li>
2514
+
2515
+ <li class="covered" data-hits="1" data-linenumber="35">
2516
+ <span class="hits">1</span>
2517
+
2518
+ <code class="ruby"> client_sign.sign_length = 2</code>
2519
+ </li>
2520
+
2521
+ <li class="covered" data-hits="1" data-linenumber="36">
2522
+ <span class="hits">1</span>
2523
+
2524
+ <code class="ruby"> expect(encode_json_html_signed).to eq(html_json_encoded({:sign_length =&gt; 2}) )</code>
2525
+ </li>
2526
+
2527
+ <li class="never" data-hits="" data-linenumber="37">
2528
+
2529
+
2530
+ <code class="ruby"> end</code>
2531
+ </li>
2532
+
2533
+ <li class="never" data-hits="" data-linenumber="38">
2534
+
2535
+
2536
+ <code class="ruby"></code>
2537
+ </li>
2538
+
2539
+ <li class="never" data-hits="" data-linenumber="39">
2540
+
2541
+
2542
+ <code class="ruby">end</code>
2543
+ </li>
2544
+
2545
+ </ol>
2546
+ </pre>
2547
+ </div>
2548
+
2549
+ <div class="source_table" id="3d3f06c48e5c0515d62b241e1473efb27036296e">
2550
+ <div class="header">
2551
+ <h3>params_encode_spec.rb</h3>
2552
+ <h4><span class="green">100.0 %</span> covered</h4>
2553
+ <div>
2554
+ <b>21</b> relevant lines.
2555
+ <span class="green"><b>21</b> lines covered</span> and
2556
+ <span class="red"><b>0</b> lines missed.</span>
2557
+ </div>
2558
+ </div>
2559
+
2560
+ <pre>
2561
+ <ol>
2562
+
2563
+ <li class="covered" data-hits="1" data-linenumber="1">
2564
+ <span class="hits">1</span>
2565
+
2566
+ <code class="ruby">require &quot;spec_helper&quot;</code>
2567
+ </li>
2568
+
2569
+ <li class="never" data-hits="" data-linenumber="2">
2570
+
2571
+
2572
+ <code class="ruby"></code>
2573
+ </li>
2574
+
2575
+ <li class="covered" data-hits="1" data-linenumber="3">
2576
+ <span class="hits">1</span>
2577
+
2578
+ <code class="ruby">describe Diversion::Encode::Params do</code>
2579
+ </li>
2580
+
2581
+ <li class="never" data-hits="" data-linenumber="4">
2582
+
2583
+
2584
+ <code class="ruby"></code>
2585
+ </li>
2586
+
2587
+ <li class="covered" data-hits="1" data-linenumber="5">
2588
+ <span class="hits">1</span>
2589
+
2590
+ <code class="ruby"> include_context &quot;params&quot;</code>
2591
+ </li>
2592
+
2593
+ <li class="never" data-hits="" data-linenumber="6">
2594
+
2595
+
2596
+ <code class="ruby"></code>
2597
+ </li>
2598
+
2599
+ <li class="covered" data-hits="1" data-linenumber="7">
2600
+ <span class="hits">1</span>
2601
+
2602
+ <code class="ruby"> it &quot;returns correct type&quot; do</code>
2603
+ </li>
2604
+
2605
+ <li class="covered" data-hits="1" data-linenumber="8">
2606
+ <span class="hits">1</span>
2607
+
2608
+ <code class="ruby"> expect(encode_email).to be_a String</code>
2609
+ </li>
2610
+
2611
+ <li class="never" data-hits="" data-linenumber="9">
2612
+
2613
+
2614
+ <code class="ruby"> end</code>
2615
+ </li>
2616
+
2617
+ <li class="never" data-hits="" data-linenumber="10">
2618
+
2619
+
2620
+ <code class="ruby"></code>
2621
+ </li>
2622
+
2623
+ <li class="covered" data-hits="1" data-linenumber="11">
2624
+ <span class="hits">1</span>
2625
+
2626
+ <code class="ruby"> it &quot;uses correct path&quot; do</code>
2627
+ </li>
2628
+
2629
+ <li class="covered" data-hits="1" data-linenumber="12">
2630
+ <span class="hits">1</span>
2631
+
2632
+ <code class="ruby"> expect(encode_params_html).to eq(html_params_encoded)</code>
2633
+ </li>
2634
+
2635
+ <li class="never" data-hits="" data-linenumber="13">
2636
+
2637
+
2638
+ <code class="ruby"> end</code>
2639
+ </li>
2640
+
2641
+ <li class="never" data-hits="" data-linenumber="14">
2642
+
2643
+
2644
+ <code class="ruby"></code>
2645
+ </li>
2646
+
2647
+ <li class="covered" data-hits="1" data-linenumber="15">
2648
+ <span class="hits">1</span>
2649
+
2650
+ <code class="ruby"> it &quot;doesn't add port for 80&quot; do</code>
2651
+ </li>
2652
+
2653
+ <li class="covered" data-hits="1" data-linenumber="16">
2654
+ <span class="hits">1</span>
2655
+
2656
+ <code class="ruby"> client.port = 80</code>
2657
+ </li>
2658
+
2659
+ <li class="covered" data-hits="1" data-linenumber="17">
2660
+ <span class="hits">1</span>
2661
+
2662
+ <code class="ruby"> expect(encode_params_html).to eq(html_params_encoded)</code>
2663
+ </li>
2664
+
2665
+ <li class="never" data-hits="" data-linenumber="18">
2666
+
2667
+
2668
+ <code class="ruby"> end</code>
2669
+ </li>
2670
+
2671
+ <li class="never" data-hits="" data-linenumber="19">
2672
+
2673
+
2674
+ <code class="ruby"> </code>
2675
+ </li>
2676
+
2677
+ <li class="covered" data-hits="1" data-linenumber="20">
2678
+ <span class="hits">1</span>
2679
+
2680
+ <code class="ruby"> it &quot;adds port number for non-80 port&quot; do</code>
2681
+ </li>
2682
+
2683
+ <li class="covered" data-hits="1" data-linenumber="21">
2684
+ <span class="hits">1</span>
2685
+
2686
+ <code class="ruby"> client.port = 81</code>
2687
+ </li>
2688
+
2689
+ <li class="covered" data-hits="1" data-linenumber="22">
2690
+ <span class="hits">1</span>
2691
+
2692
+ <code class="ruby"> expect(encode_params_html).to eq(html_params_encoded({:port =&gt; 81}))</code>
2693
+ </li>
2694
+
2695
+ <li class="never" data-hits="" data-linenumber="23">
2696
+
2697
+
2698
+ <code class="ruby"> end</code>
2699
+ </li>
2700
+
2701
+ <li class="never" data-hits="" data-linenumber="24">
2702
+
2703
+
2704
+ <code class="ruby"></code>
2705
+ </li>
2706
+
2707
+ <li class="covered" data-hits="1" data-linenumber="25">
2708
+ <span class="hits">1</span>
2709
+
2710
+ <code class="ruby"> it &quot;doesn't sign by default&quot; do</code>
2711
+ </li>
2712
+
2713
+ <li class="covered" data-hits="1" data-linenumber="26">
2714
+ <span class="hits">1</span>
2715
+
2716
+ <code class="ruby"> expect(encode_params_html).to eq(html_params_encoded)</code>
2717
+ </li>
2718
+
2719
+ <li class="never" data-hits="" data-linenumber="27">
2720
+
2721
+
2722
+ <code class="ruby"> end</code>
2723
+ </li>
2724
+
2725
+ <li class="never" data-hits="" data-linenumber="28">
2726
+
2727
+
2728
+ <code class="ruby"></code>
2729
+ </li>
2730
+
2731
+ <li class="covered" data-hits="1" data-linenumber="29">
2732
+ <span class="hits">1</span>
2733
+
2734
+ <code class="ruby"> it &quot;signs correctly&quot; do</code>
2735
+ </li>
2736
+
2737
+ <li class="covered" data-hits="1" data-linenumber="30">
2738
+ <span class="hits">1</span>
2739
+
2740
+ <code class="ruby"> client_sign.sign_length = 32</code>
2741
+ </li>
2742
+
2743
+ <li class="covered" data-hits="1" data-linenumber="31">
2744
+ <span class="hits">1</span>
2745
+
2746
+ <code class="ruby"> expect(encode_params_html_signed).to eq(html_params_encoded({:sign_length =&gt; DEFAULT_SIGN_LEN}))</code>
2747
+ </li>
2748
+
2749
+ <li class="never" data-hits="" data-linenumber="32">
2750
+
2751
+
2752
+ <code class="ruby"> end</code>
2753
+ </li>
2754
+
2755
+ <li class="never" data-hits="" data-linenumber="33">
2756
+
2757
+
2758
+ <code class="ruby"></code>
2759
+ </li>
2760
+
2761
+ <li class="covered" data-hits="1" data-linenumber="34">
2762
+ <span class="hits">1</span>
2763
+
2764
+ <code class="ruby"> it &quot;observes sign_length&quot; do</code>
2765
+ </li>
2766
+
2767
+ <li class="covered" data-hits="1" data-linenumber="35">
2768
+ <span class="hits">1</span>
2769
+
2770
+ <code class="ruby"> client_sign.sign_length = 2</code>
2771
+ </li>
2772
+
2773
+ <li class="covered" data-hits="1" data-linenumber="36">
2774
+ <span class="hits">1</span>
2775
+
2776
+ <code class="ruby"> expect(encode_params_html_signed).to eq(html_params_encoded({:sign_length =&gt; 2}))</code>
2777
+ </li>
2778
+
2779
+ <li class="never" data-hits="" data-linenumber="37">
2780
+
2781
+
2782
+ <code class="ruby"> end</code>
2783
+ </li>
2784
+
2785
+ <li class="never" data-hits="" data-linenumber="38">
2786
+
2787
+
2788
+ <code class="ruby"></code>
2789
+ </li>
2790
+
2791
+ <li class="never" data-hits="" data-linenumber="39">
2792
+
2793
+
2794
+ <code class="ruby">end</code>
2795
+ </li>
2796
+
2797
+ </ol>
2798
+ </pre>
2799
+ </div>
2800
+
2801
+ <div class="source_table" id="7415e83dc14ec7500a4a9a66846d7c0948f9c248">
2802
+ <div class="header">
2803
+ <h3>support/global_shared_context.rb</h3>
2804
+ <h4><span class="green">100.0 %</span> covered</h4>
2805
+ <div>
2806
+ <b>22</b> relevant lines.
2807
+ <span class="green"><b>22</b> lines covered</span> and
2808
+ <span class="red"><b>0</b> lines missed.</span>
2809
+ </div>
2810
+ </div>
2811
+
2812
+ <pre>
2813
+ <ol>
2814
+
2815
+ <li class="covered" data-hits="1" data-linenumber="1">
2816
+ <span class="hits">1</span>
2817
+
2818
+ <code class="ruby">def use_json </code>
2819
+ </li>
2820
+
2821
+ <li class="covered" data-hits="23" data-linenumber="2">
2822
+ <span class="hits">23</span>
2823
+
2824
+ <code class="ruby"> { :url_encoding =&gt; Diversion::Encode::Json, :url_decoding =&gt; Diversion::Decode::Json }</code>
2825
+ </li>
2826
+
2827
+ <li class="never" data-hits="" data-linenumber="3">
2828
+
2829
+
2830
+ <code class="ruby">end</code>
2831
+ </li>
2832
+
2833
+ <li class="never" data-hits="" data-linenumber="4">
2834
+
2835
+
2836
+ <code class="ruby"></code>
2837
+ </li>
2838
+
2839
+ <li class="covered" data-hits="1" data-linenumber="5">
2840
+ <span class="hits">1</span>
2841
+
2842
+ <code class="ruby">def use_params</code>
2843
+ </li>
2844
+
2845
+ <li class="covered" data-hits="19" data-linenumber="6">
2846
+ <span class="hits">19</span>
2847
+
2848
+ <code class="ruby"> { :url_encoding =&gt; Diversion::Encode::Params, :url_decoding =&gt; Diversion::Decode::Params }</code>
2849
+ </li>
2850
+
2851
+ <li class="never" data-hits="" data-linenumber="7">
2852
+
2853
+
2854
+ <code class="ruby">end</code>
2855
+ </li>
2856
+
2857
+ <li class="never" data-hits="" data-linenumber="8">
2858
+
2859
+
2860
+ <code class="ruby"></code>
2861
+ </li>
2862
+
2863
+ <li class="covered" data-hits="1" data-linenumber="9">
2864
+ <span class="hits">1</span>
2865
+
2866
+ <code class="ruby">shared_context 'json' do</code>
2867
+ </li>
2868
+
2869
+ <li class="covered" data-hits="21" data-linenumber="10">
2870
+ <span class="hits">21</span>
2871
+
2872
+ <code class="ruby"> let(:client) { @client ||= Diversion::Client.new(use_json) }</code>
2873
+ </li>
2874
+
2875
+ <li class="covered" data-hits="12" data-linenumber="11">
2876
+ <span class="hits">12</span>
2877
+
2878
+ <code class="ruby"> let(:client_sign) { @client ||= Diversion::Client.new(use_json.merge({:sign_length =&gt; 32, :sign_key =&gt; SIGN_KEY})) }</code>
2879
+ </li>
2880
+
2881
+ <li class="covered" data-hits="8" data-linenumber="12">
2882
+ <span class="hits">8</span>
2883
+
2884
+ <code class="ruby"> let(:encode_email) { @email = client.encode(fixture('mail.html').read, {:a =&gt; 1}) }</code>
2885
+ </li>
2886
+
2887
+ <li class="covered" data-hits="8" data-linenumber="13">
2888
+ <span class="hits">8</span>
2889
+
2890
+ <code class="ruby"> let(:encode_json_html) { client.encode(HTML) }</code>
2891
+ </li>
2892
+
2893
+ <li class="covered" data-hits="8" data-linenumber="14">
2894
+ <span class="hits">8</span>
2895
+
2896
+ <code class="ruby"> let(:encode_json_html_signed) { client_sign.encode(HTML) }</code>
2897
+ </li>
2898
+
2899
+ <li class="covered" data-hits="7" data-linenumber="15">
2900
+ <span class="hits">7</span>
2901
+
2902
+ <code class="ruby"> let(:decode_json) { client.decode(JSON_ENCODED) }</code>
2903
+ </li>
2904
+
2905
+ <li class="covered" data-hits="6" data-linenumber="16">
2906
+ <span class="hits">6</span>
2907
+
2908
+ <code class="ruby"> let(:decode_json_signed) { client_sign.decode(JSON_ENCODED_SIGNED) }</code>
2909
+ </li>
2910
+
2911
+ <li class="covered" data-hits="5" data-linenumber="17">
2912
+ <span class="hits">5</span>
2913
+
2914
+ <code class="ruby"> let(:decode_json_bad_key) { client_sign.decode(JSON_ENCODED_SIGNED_KEY_BAD) }</code>
2915
+ </li>
2916
+
2917
+ <li class="never" data-hits="" data-linenumber="18">
2918
+
2919
+
2920
+ <code class="ruby">end</code>
2921
+ </li>
2922
+
2923
+ <li class="never" data-hits="" data-linenumber="19">
2924
+
2925
+
2926
+ <code class="ruby"></code>
2927
+ </li>
2928
+
2929
+ <li class="covered" data-hits="1" data-linenumber="20">
2930
+ <span class="hits">1</span>
2931
+
2932
+ <code class="ruby">shared_context 'params' do</code>
2933
+ </li>
2934
+
2935
+ <li class="covered" data-hits="15" data-linenumber="21">
2936
+ <span class="hits">15</span>
2937
+
2938
+ <code class="ruby"> let(:client) { Diversion::Client.new(use_params) }</code>
2939
+ </li>
2940
+
2941
+ <li class="covered" data-hits="8" data-linenumber="22">
2942
+ <span class="hits">8</span>
2943
+
2944
+ <code class="ruby"> let(:client_sign) { Diversion::Client.new(use_params.merge({:sign_length =&gt; 32, :sign_key =&gt; SIGN_KEY})) }</code>
2945
+ </li>
2946
+
2947
+ <li class="covered" data-hits="3" data-linenumber="23">
2948
+ <span class="hits">3</span>
2949
+
2950
+ <code class="ruby"> let(:encode_email) { @email = client.encode(fixture('mail.html').read, {:a =&gt; 1}) }</code>
2951
+ </li>
2952
+
2953
+ <li class="covered" data-hits="6" data-linenumber="24">
2954
+ <span class="hits">6</span>
2955
+
2956
+ <code class="ruby"> let(:encode_params_html) { client.encode(HTML) }</code>
2957
+ </li>
2958
+
2959
+ <li class="covered" data-hits="4" data-linenumber="25">
2960
+ <span class="hits">4</span>
2961
+
2962
+ <code class="ruby"> let(:encode_params_html_signed) { client_sign.encode(HTML) }</code>
2963
+ </li>
2964
+
2965
+ <li class="covered" data-hits="4" data-linenumber="26">
2966
+ <span class="hits">4</span>
2967
+
2968
+ <code class="ruby"> let(:decode_params) { client.decode(PARAMS_ENCODED) }</code>
2969
+ </li>
2970
+
2971
+ <li class="covered" data-hits="4" data-linenumber="27">
2972
+ <span class="hits">4</span>
2973
+
2974
+ <code class="ruby"> let(:decode_params_signed) { client_sign.decode(PARAMS_ENCODED_SIGNED) }</code>
2975
+ </li>
2976
+
2977
+ <li class="covered" data-hits="3" data-linenumber="28">
2978
+ <span class="hits">3</span>
2979
+
2980
+ <code class="ruby"> let(:decode_params_bad_key) { client_sign.decode(PARAMS_ENCODED_SIGNED_KEY_BAD) }</code>
2981
+ </li>
2982
+
2983
+ <li class="never" data-hits="" data-linenumber="29">
2984
+
2985
+
2986
+ <code class="ruby">end</code>
2987
+ </li>
2988
+
2989
+ </ol>
2990
+ </pre>
2991
+ </div>
2992
+
2993
+ <div class="source_table" id="2eeadc78f5528a6adfeeaac28ef4a4ae46fda94a">
2994
+ <div class="header">
2995
+ <h3>url_spec.rb</h3>
2996
+ <h4><span class="green">100.0 %</span> covered</h4>
2997
+ <div>
2998
+ <b>15</b> relevant lines.
2999
+ <span class="green"><b>15</b> lines covered</span> and
3000
+ <span class="red"><b>0</b> lines missed.</span>
3001
+ </div>
3002
+ </div>
3003
+
3004
+ <pre>
3005
+ <ol>
3006
+
3007
+ <li class="covered" data-hits="1" data-linenumber="1">
3008
+ <span class="hits">1</span>
3009
+
3010
+ <code class="ruby">require &quot;spec_helper&quot;</code>
3011
+ </li>
3012
+
3013
+ <li class="never" data-hits="" data-linenumber="2">
3014
+
3015
+
3016
+ <code class="ruby"></code>
3017
+ </li>
3018
+
3019
+ <li class="covered" data-hits="1" data-linenumber="3">
3020
+ <span class="hits">1</span>
3021
+
3022
+ <code class="ruby">describe &quot;Test Url Encoding&quot; do</code>
3023
+ </li>
3024
+
3025
+ <li class="never" data-hits="" data-linenumber="4">
3026
+
3027
+
3028
+ <code class="ruby"></code>
3029
+ </li>
3030
+
3031
+ <li class="covered" data-hits="1" data-linenumber="5">
3032
+ <span class="hits">1</span>
3033
+
3034
+ <code class="ruby"> it &quot;can encode/decode URL successfully&quot; do</code>
3035
+ </li>
3036
+
3037
+ <li class="covered" data-hits="1" data-linenumber="6">
3038
+ <span class="hits">1</span>
3039
+
3040
+ <code class="ruby"> attrs = { :test =&gt; 1234, :url =&gt; 'http://somewhere.over.rainbow'}</code>
3041
+ </li>
3042
+
3043
+ <li class="covered" data-hits="1" data-linenumber="7">
3044
+ <span class="hits">1</span>
3045
+
3046
+ <code class="ruby"> url = &quot;d=#{CGI::escape(attrs.to_param)}&amp;s=testkey&quot;</code>
3047
+ </li>
3048
+
3049
+ <li class="covered" data-hits="1" data-linenumber="8">
3050
+ <span class="hits">1</span>
3051
+
3052
+ <code class="ruby"> parsed = CGI::parse(url)</code>
3053
+ </li>
3054
+
3055
+ <li class="never" data-hits="" data-linenumber="9">
3056
+
3057
+
3058
+ <code class="ruby"> #puts parsed</code>
3059
+ </li>
3060
+
3061
+ <li class="covered" data-hits="1" data-linenumber="10">
3062
+ <span class="hits">1</span>
3063
+
3064
+ <code class="ruby"> expect(parsed.length).to eq(2)</code>
3065
+ </li>
3066
+
3067
+ <li class="covered" data-hits="1" data-linenumber="11">
3068
+ <span class="hits">1</span>
3069
+
3070
+ <code class="ruby"> expect(parsed.has_key?('d')).to be_true</code>
3071
+ </li>
3072
+
3073
+ <li class="covered" data-hits="1" data-linenumber="12">
3074
+ <span class="hits">1</span>
3075
+
3076
+ <code class="ruby"> expect(parsed.has_key?('s')).to be_true</code>
3077
+ </li>
3078
+
3079
+ <li class="covered" data-hits="1" data-linenumber="13">
3080
+ <span class="hits">1</span>
3081
+
3082
+ <code class="ruby"> expect(parsed.has_key?('url')).to be_false</code>
3083
+ </li>
3084
+
3085
+ <li class="covered" data-hits="1" data-linenumber="14">
3086
+ <span class="hits">1</span>
3087
+
3088
+ <code class="ruby"> expect(parsed.has_key?('test')).to be_false</code>
3089
+ </li>
3090
+
3091
+ <li class="covered" data-hits="1" data-linenumber="15">
3092
+ <span class="hits">1</span>
3093
+
3094
+ <code class="ruby"> expect(parsed['s'].first).to eq(&quot;testkey&quot;)</code>
3095
+ </li>
3096
+
3097
+ <li class="covered" data-hits="1" data-linenumber="16">
3098
+ <span class="hits">1</span>
3099
+
3100
+ <code class="ruby"> data = CGI::parse(parsed['d'].first)</code>
3101
+ </li>
3102
+
3103
+ <li class="never" data-hits="" data-linenumber="17">
3104
+
3105
+
3106
+ <code class="ruby"> #puts data</code>
3107
+ </li>
3108
+
3109
+ <li class="covered" data-hits="1" data-linenumber="18">
3110
+ <span class="hits">1</span>
3111
+
3112
+ <code class="ruby"> expect(data['test'].first).to eq(&quot;1234&quot;)</code>
3113
+ </li>
3114
+
3115
+ <li class="covered" data-hits="1" data-linenumber="19">
3116
+ <span class="hits">1</span>
3117
+
3118
+ <code class="ruby"> expect(data['url'].first).to eq(&quot;http://somewhere.over.rainbow&quot;)</code>
3119
+ </li>
3120
+
3121
+ <li class="never" data-hits="" data-linenumber="20">
3122
+
3123
+
3124
+ <code class="ruby"> end</code>
3125
+ </li>
3126
+
3127
+ <li class="never" data-hits="" data-linenumber="21">
3128
+
3129
+
3130
+ <code class="ruby"></code>
3131
+ </li>
3132
+
3133
+ <li class="never" data-hits="" data-linenumber="22">
3134
+
3135
+
3136
+ <code class="ruby">end</code>
3137
+ </li>
3138
+
3139
+ </ol>
3140
+ </pre>
3141
+ </div>
3142
+
3143
+ </div>
3144
+ </div>
3145
+ </body>
3146
+ </html>