http_spec 0.3.0 → 0.4.0

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