rubocop-rspec 1.0.rc1 → 1.0.rc2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (41) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +12 -14
  3. data/README.md +2 -1
  4. data/lib/rubocop/cop/rspec_file_name.rb +10 -15
  5. data/lib/rubocop/rspec/version.rb +1 -1
  6. data/rubocop-rspec.gemspec +7 -1
  7. data/spec/project_spec.rb +118 -0
  8. data/spec/rubocop/cop/rspec_file_name_spec.rb +32 -11
  9. metadata +10 -40
  10. data/Gemfile.lock +0 -289
  11. data/config/default.yml +0 -27
  12. data/coverage/assets/0.8.0/application.css +0 -799
  13. data/coverage/assets/0.8.0/application.js +0 -1559
  14. data/coverage/assets/0.8.0/colorbox/border.png +0 -0
  15. data/coverage/assets/0.8.0/colorbox/controls.png +0 -0
  16. data/coverage/assets/0.8.0/colorbox/loading.gif +0 -0
  17. data/coverage/assets/0.8.0/colorbox/loading_background.png +0 -0
  18. data/coverage/assets/0.8.0/favicon_green.png +0 -0
  19. data/coverage/assets/0.8.0/favicon_red.png +0 -0
  20. data/coverage/assets/0.8.0/favicon_yellow.png +0 -0
  21. data/coverage/assets/0.8.0/loading.gif +0 -0
  22. data/coverage/assets/0.8.0/magnify.png +0 -0
  23. data/coverage/assets/0.8.0/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
  24. data/coverage/assets/0.8.0/smoothness/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
  25. data/coverage/assets/0.8.0/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
  26. data/coverage/assets/0.8.0/smoothness/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
  27. data/coverage/assets/0.8.0/smoothness/images/ui-bg_glass_75_dadada_1x400.png +0 -0
  28. data/coverage/assets/0.8.0/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
  29. data/coverage/assets/0.8.0/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
  30. data/coverage/assets/0.8.0/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
  31. data/coverage/assets/0.8.0/smoothness/images/ui-icons_222222_256x240.png +0 -0
  32. data/coverage/assets/0.8.0/smoothness/images/ui-icons_2e83ff_256x240.png +0 -0
  33. data/coverage/assets/0.8.0/smoothness/images/ui-icons_454545_256x240.png +0 -0
  34. data/coverage/assets/0.8.0/smoothness/images/ui-icons_888888_256x240.png +0 -0
  35. data/coverage/assets/0.8.0/smoothness/images/ui-icons_cd0a0a_256x240.png +0 -0
  36. data/coverage/index.html +0 -1224
  37. data/pkg/rubocop-rspec-0.1.0.gem +0 -0
  38. data/pkg/rubocop-rspec-0.17.0.gem +0 -0
  39. data/pkg/rubocop-rspec-0.18.0.gem +0 -0
  40. data/pkg/rubocop-rspec-0.18.1.gem +0 -0
  41. data/pkg/rubocop-rspec-1.0.rc1.gem +0 -0
Binary file
Binary file
Binary file
data/coverage/index.html DELETED
@@ -1,1224 +0,0 @@
1
- <!DOCTYPE html>
2
- <html xmlns='http://www.w3.org/1999/xhtml'>
3
- <head>
4
- <title>Code coverage for Rubocop-rspec</title>
5
- <meta http-equiv="content-type" content="text/html; charset=utf-8" />
6
- <script src='./assets/0.8.0/application.js' type='text/javascript'></script>
7
- <link href='./assets/0.8.0/application.css' media='screen, projection, print' rel='stylesheet' type='text/css'>
8
- <link rel="shortcut icon" type="image/png" href="./assets/0.8.0/favicon_green.png" />
9
- <link rel="icon" type="image/png" href="./assets/0.8.0/favicon.png" />
10
- </head>
11
-
12
- <body>
13
- <div id="loading">
14
- <img src="./assets/0.8.0/loading.gif" alt="loading"/>
15
- </div>
16
- <div id="wrapper" style="display:none;">
17
- <div class="timestamp">Generated <abbr class="timeago" title="2014-01-26T14:28:51-08:00">2014-01-26T14:28:51-08: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
- 7.42
29
- </span>
30
- </span> hits/line)
31
- </h2>
32
- <a name="AllFiles"></a>
33
- <div>
34
- <b>3</b> files in total.
35
- <b>85</b> relevant lines.
36
- <span class="green"><b>85</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="#144d9fb0cbcd9dd3b9abca0052255bae258b7b65" class="src_link" title="lib/rubocop-rspec.rb">lib/rubocop-rspec.rb</a></td>
55
- <td class="green strong">100.0 %</td>
56
- <td>13</td>
57
- <td>5</td>
58
- <td>5</td>
59
- <td>0</td>
60
- <td>1.0</td>
61
- </tr>
62
-
63
- <tr>
64
- <td class="strong"><a href="#8b6ab8aec7d98e7c57ee05807d318c8916a5bf61" class="src_link" title="lib/rubocop/cop/rspec/unit_spec_naming.rb">lib/rubocop/cop/rspec/unit_spec_naming.rb</a></td>
65
- <td class="green strong">100.0 %</td>
66
- <td>144</td>
67
- <td>70</td>
68
- <td>70</td>
69
- <td>0</td>
70
- <td>8.8</td>
71
- </tr>
72
-
73
- <tr>
74
- <td class="strong"><a href="#ed32ac750f248391bff2e2fec5aa10d4c722b8f6" class="src_link" title="lib/rubocop/rspec/inject.rb">lib/rubocop/rspec/inject.rb</a></td>
75
- <td class="green strong">100.0 %</td>
76
- <td>21</td>
77
- <td>10</td>
78
- <td>10</td>
79
- <td>0</td>
80
- <td>1.0</td>
81
- </tr>
82
-
83
- </tbody>
84
- </table>
85
- </div>
86
-
87
-
88
-
89
- </div>
90
-
91
- <div id="footer">
92
- Generated by <a href="http://github.com/colszowka/simplecov">simplecov</a> v0.8.2
93
- and simplecov-html v0.8.0<br/>
94
- using RSpec
95
- </div>
96
-
97
- <div class="source_files">
98
-
99
- <div class="source_table" id="144d9fb0cbcd9dd3b9abca0052255bae258b7b65">
100
- <div class="header">
101
- <h3>lib/rubocop-rspec.rb</h3>
102
- <h4><span class="green">100.0 %</span> covered</h4>
103
- <div>
104
- <b>5</b> relevant lines.
105
- <span class="green"><b>5</b> lines covered</span> and
106
- <span class="red"><b>0</b> lines missed.</span>
107
- </div>
108
- </div>
109
-
110
- <pre>
111
- <ol>
112
-
113
- <li class="never" data-hits="" data-linenumber="1">
114
-
115
-
116
- <code class="ruby"># encoding: utf-8</code>
117
- </li>
118
-
119
- <li class="never" data-hits="" data-linenumber="2">
120
-
121
-
122
- <code class="ruby"></code>
123
- </li>
124
-
125
- <li class="covered" data-hits="1" data-linenumber="3">
126
- <span class="hits">1</span>
127
-
128
- <code class="ruby">require &#39;rubocop&#39;</code>
129
- </li>
130
-
131
- <li class="never" data-hits="" data-linenumber="4">
132
-
133
-
134
- <code class="ruby"></code>
135
- </li>
136
-
137
- <li class="covered" data-hits="1" data-linenumber="5">
138
- <span class="hits">1</span>
139
-
140
- <code class="ruby">require &#39;rubocop/rspec/version&#39;</code>
141
- </li>
142
-
143
- <li class="covered" data-hits="1" data-linenumber="6">
144
- <span class="hits">1</span>
145
-
146
- <code class="ruby">require &#39;rubocop/rspec/inject&#39;</code>
147
- </li>
148
-
149
- <li class="never" data-hits="" data-linenumber="7">
150
-
151
-
152
- <code class="ruby"></code>
153
- </li>
154
-
155
- <li class="covered" data-hits="1" data-linenumber="8">
156
- <span class="hits">1</span>
157
-
158
- <code class="ruby">Rubocop::RSpec::Inject.defaults!</code>
159
- </li>
160
-
161
- <li class="never" data-hits="" data-linenumber="9">
162
-
163
-
164
- <code class="ruby"></code>
165
- </li>
166
-
167
- <li class="never" data-hits="" data-linenumber="10">
168
-
169
-
170
- <code class="ruby"># We are housing ourselves directly into RuboCop&#39;s module structure. This is</code>
171
- </li>
172
-
173
- <li class="never" data-hits="" data-linenumber="11">
174
-
175
-
176
- <code class="ruby"># less than ideal, but until RuboCop directly supports plugins, we can avoid</code>
177
- </li>
178
-
179
- <li class="never" data-hits="" data-linenumber="12">
180
-
181
-
182
- <code class="ruby"># breaking too many assumptions.</code>
183
- </li>
184
-
185
- <li class="covered" data-hits="1" data-linenumber="13">
186
- <span class="hits">1</span>
187
-
188
- <code class="ruby">require &#39;rubocop/cop/rspec/unit_spec_naming&#39;</code>
189
- </li>
190
-
191
- </ol>
192
- </pre>
193
- </div>
194
-
195
- <div class="source_table" id="8b6ab8aec7d98e7c57ee05807d318c8916a5bf61">
196
- <div class="header">
197
- <h3>lib/rubocop/cop/rspec/unit_spec_naming.rb</h3>
198
- <h4><span class="green">100.0 %</span> covered</h4>
199
- <div>
200
- <b>70</b> relevant lines.
201
- <span class="green"><b>70</b> lines covered</span> and
202
- <span class="red"><b>0</b> lines missed.</span>
203
- </div>
204
- </div>
205
-
206
- <pre>
207
- <ol>
208
-
209
- <li class="never" data-hits="" data-linenumber="1">
210
-
211
-
212
- <code class="ruby"># encoding: utf-8</code>
213
- </li>
214
-
215
- <li class="never" data-hits="" data-linenumber="2">
216
-
217
-
218
- <code class="ruby"></code>
219
- </li>
220
-
221
- <li class="covered" data-hits="1" data-linenumber="3">
222
- <span class="hits">1</span>
223
-
224
- <code class="ruby">module Rubocop</code>
225
- </li>
226
-
227
- <li class="covered" data-hits="1" data-linenumber="4">
228
- <span class="hits">1</span>
229
-
230
- <code class="ruby"> module Cop</code>
231
- </li>
232
-
233
- <li class="covered" data-hits="1" data-linenumber="5">
234
- <span class="hits">1</span>
235
-
236
- <code class="ruby"> module RSpec</code>
237
- </li>
238
-
239
- <li class="never" data-hits="" data-linenumber="6">
240
-
241
-
242
- <code class="ruby"> # This cop checks that RSpec unit tests conform to a consistent naming</code>
243
- </li>
244
-
245
- <li class="never" data-hits="" data-linenumber="7">
246
-
247
-
248
- <code class="ruby"> # scheme - both for the describe call, and the file path.</code>
249
- </li>
250
-
251
- <li class="never" data-hits="" data-linenumber="8">
252
-
253
-
254
- <code class="ruby"> #</code>
255
- </li>
256
-
257
- <li class="never" data-hits="" data-linenumber="9">
258
-
259
-
260
- <code class="ruby"> # Disabled by default. Generally, you want to scope it to your project&#39;s</code>
261
- </li>
262
-
263
- <li class="never" data-hits="" data-linenumber="10">
264
-
265
-
266
- <code class="ruby"> # unit spec paths:</code>
267
- </li>
268
-
269
- <li class="never" data-hits="" data-linenumber="11">
270
-
271
-
272
- <code class="ruby"> #</code>
273
- </li>
274
-
275
- <li class="never" data-hits="" data-linenumber="12">
276
-
277
-
278
- <code class="ruby"> # UnitSpecNaming:</code>
279
- </li>
280
-
281
- <li class="never" data-hits="" data-linenumber="13">
282
-
283
-
284
- <code class="ruby"> # Enabled: true</code>
285
- </li>
286
-
287
- <li class="never" data-hits="" data-linenumber="14">
288
-
289
-
290
- <code class="ruby"> # Include:</code>
291
- </li>
292
-
293
- <li class="never" data-hits="" data-linenumber="15">
294
-
295
-
296
- <code class="ruby"> # - &#39;spec/rubocop/*&#39;</code>
297
- </li>
298
-
299
- <li class="never" data-hits="" data-linenumber="16">
300
-
301
-
302
- <code class="ruby"> #</code>
303
- </li>
304
-
305
- <li class="covered" data-hits="1" data-linenumber="17">
306
- <span class="hits">1</span>
307
-
308
- <code class="ruby"> class UnitSpecNaming &lt; Cop</code>
309
- </li>
310
-
311
- <li class="covered" data-hits="1" data-linenumber="18">
312
- <span class="hits">1</span>
313
-
314
- <code class="ruby"> DESCRIBE_CLASS_MSG = &#39;The first argument to describe should be the &#39; \</code>
315
- </li>
316
-
317
- <li class="never" data-hits="" data-linenumber="19">
318
-
319
-
320
- <code class="ruby"> &#39;class or module being tested.&#39;</code>
321
- </li>
322
-
323
- <li class="never" data-hits="" data-linenumber="20">
324
-
325
-
326
- <code class="ruby"></code>
327
- </li>
328
-
329
- <li class="covered" data-hits="1" data-linenumber="21">
330
- <span class="hits">1</span>
331
-
332
- <code class="ruby"> METHOD_STRING_MSG = &#39;The second argument to describe should be the &#39; \</code>
333
- </li>
334
-
335
- <li class="never" data-hits="" data-linenumber="22">
336
-
337
-
338
- <code class="ruby"> &quot;method being tested. &#39;#instance&#39; or &#39;.class&#39;&quot;</code>
339
- </li>
340
-
341
- <li class="never" data-hits="" data-linenumber="23">
342
-
343
-
344
- <code class="ruby"></code>
345
- </li>
346
-
347
- <li class="covered" data-hits="1" data-linenumber="24">
348
- <span class="hits">1</span>
349
-
350
- <code class="ruby"> CLASS_SPEC_MSG = &#39;Class unit spec should have a path ending with %s&#39;</code>
351
- </li>
352
-
353
- <li class="never" data-hits="" data-linenumber="25">
354
-
355
-
356
- <code class="ruby"></code>
357
- </li>
358
-
359
- <li class="covered" data-hits="1" data-linenumber="26">
360
- <span class="hits">1</span>
361
-
362
- <code class="ruby"> METHOD_SPEC_MSG = &#39;Unit spec should have a path matching %s&#39;</code>
363
- </li>
364
-
365
- <li class="never" data-hits="" data-linenumber="27">
366
-
367
-
368
- <code class="ruby"></code>
369
- </li>
370
-
371
- <li class="covered" data-hits="1" data-linenumber="28">
372
- <span class="hits">1</span>
373
-
374
- <code class="ruby"> METHOD_STRING_MATCHER = /^[\#\.].+/</code>
375
- </li>
376
-
377
- <li class="never" data-hits="" data-linenumber="29">
378
-
379
-
380
- <code class="ruby"></code>
381
- </li>
382
-
383
- <li class="covered" data-hits="1" data-linenumber="30">
384
- <span class="hits">1</span>
385
-
386
- <code class="ruby"> def on_send(node)</code>
387
- </li>
388
-
389
- <li class="covered" data-hits="20" data-linenumber="31">
390
- <span class="hits">20</span>
391
-
392
- <code class="ruby"> return unless top_level_describe? node</code>
393
- </li>
394
-
395
- <li class="covered" data-hits="17" data-linenumber="32">
396
- <span class="hits">17</span>
397
-
398
- <code class="ruby"> _receiver, _method_name, *args = *node</code>
399
- </li>
400
-
401
- <li class="never" data-hits="" data-linenumber="33">
402
-
403
-
404
- <code class="ruby"> # Ignore non-string args (RSpec metadata)</code>
405
- </li>
406
-
407
- <li class="covered" data-hits="26" data-linenumber="34">
408
- <span class="hits">26</span>
409
-
410
- <code class="ruby"> args = [args.first] + args[1..-1].select { |a| a.type == :str }</code>
411
- </li>
412
-
413
- <li class="never" data-hits="" data-linenumber="35">
414
-
415
-
416
- <code class="ruby"></code>
417
- </li>
418
-
419
- <li class="covered" data-hits="17" data-linenumber="36">
420
- <span class="hits">17</span>
421
-
422
- <code class="ruby"> if cop_config[&#39;EnforceDescribeStatement&#39;]</code>
423
- </li>
424
-
425
- <li class="covered" data-hits="6" data-linenumber="37">
426
- <span class="hits">6</span>
427
-
428
- <code class="ruby"> enforce_describe_statement(node, args)</code>
429
- </li>
430
-
431
- <li class="never" data-hits="" data-linenumber="38">
432
-
433
-
434
- <code class="ruby"> end</code>
435
- </li>
436
-
437
- <li class="never" data-hits="" data-linenumber="39">
438
-
439
-
440
- <code class="ruby"></code>
441
- </li>
442
-
443
- <li class="covered" data-hits="17" data-linenumber="40">
444
- <span class="hits">17</span>
445
-
446
- <code class="ruby"> if offences.size == 0 &amp;&amp; cop_config[&#39;EnforceFilenames&#39;]</code>
447
- </li>
448
-
449
- <li class="covered" data-hits="11" data-linenumber="41">
450
- <span class="hits">11</span>
451
-
452
- <code class="ruby"> enforce_filename(node, args)</code>
453
- </li>
454
-
455
- <li class="never" data-hits="" data-linenumber="42">
456
-
457
-
458
- <code class="ruby"> end</code>
459
- </li>
460
-
461
- <li class="never" data-hits="" data-linenumber="43">
462
-
463
-
464
- <code class="ruby"> end</code>
465
- </li>
466
-
467
- <li class="never" data-hits="" data-linenumber="44">
468
-
469
-
470
- <code class="ruby"></code>
471
- </li>
472
-
473
- <li class="covered" data-hits="1" data-linenumber="45">
474
- <span class="hits">1</span>
475
-
476
- <code class="ruby"> private</code>
477
- </li>
478
-
479
- <li class="never" data-hits="" data-linenumber="46">
480
-
481
-
482
- <code class="ruby"></code>
483
- </li>
484
-
485
- <li class="covered" data-hits="1" data-linenumber="47">
486
- <span class="hits">1</span>
487
-
488
- <code class="ruby"> def enforce_describe_statement(node, args)</code>
489
- </li>
490
-
491
- <li class="covered" data-hits="6" data-linenumber="48">
492
- <span class="hits">6</span>
493
-
494
- <code class="ruby"> check_described_class(node, args.first)</code>
495
- </li>
496
-
497
- <li class="covered" data-hits="6" data-linenumber="49">
498
- <span class="hits">6</span>
499
-
500
- <code class="ruby"> check_described_method(node, args[1])</code>
501
- </li>
502
-
503
- <li class="never" data-hits="" data-linenumber="50">
504
-
505
-
506
- <code class="ruby"> end</code>
507
- </li>
508
-
509
- <li class="never" data-hits="" data-linenumber="51">
510
-
511
-
512
- <code class="ruby"></code>
513
- </li>
514
-
515
- <li class="covered" data-hits="1" data-linenumber="52">
516
- <span class="hits">1</span>
517
-
518
- <code class="ruby"> def enforce_filename(node, args)</code>
519
- </li>
520
-
521
- <li class="covered" data-hits="11" data-linenumber="53">
522
- <span class="hits">11</span>
523
-
524
- <code class="ruby"> path_parts = const_name(args.first).split(&#39;::&#39;).map do |part|</code>
525
- </li>
526
-
527
- <li class="covered" data-hits="17" data-linenumber="54">
528
- <span class="hits">17</span>
529
-
530
- <code class="ruby"> camel_to_underscore(part)</code>
531
- </li>
532
-
533
- <li class="never" data-hits="" data-linenumber="55">
534
-
535
-
536
- <code class="ruby"> end</code>
537
- </li>
538
-
539
- <li class="never" data-hits="" data-linenumber="56">
540
-
541
-
542
- <code class="ruby"></code>
543
- </li>
544
-
545
- <li class="covered" data-hits="11" data-linenumber="57">
546
- <span class="hits">11</span>
547
-
548
- <code class="ruby"> if !args[1]</code>
549
- </li>
550
-
551
- <li class="covered" data-hits="5" data-linenumber="58">
552
- <span class="hits">5</span>
553
-
554
- <code class="ruby"> check_class_spec(node, path_parts)</code>
555
- </li>
556
-
557
- <li class="never" data-hits="" data-linenumber="59">
558
-
559
-
560
- <code class="ruby"> else</code>
561
- </li>
562
-
563
- <li class="covered" data-hits="6" data-linenumber="60">
564
- <span class="hits">6</span>
565
-
566
- <code class="ruby"> method_str = args[1].children.first if args[1]</code>
567
- </li>
568
-
569
- <li class="covered" data-hits="6" data-linenumber="61">
570
- <span class="hits">6</span>
571
-
572
- <code class="ruby"> path_parts &lt;&lt; &#39;class_methods&#39; if method_str.start_with? &#39;.&#39;</code>
573
- </li>
574
-
575
- <li class="covered" data-hits="6" data-linenumber="62">
576
- <span class="hits">6</span>
577
-
578
- <code class="ruby"> check_method_spec(node, path_parts, method_str)</code>
579
- </li>
580
-
581
- <li class="never" data-hits="" data-linenumber="63">
582
-
583
-
584
- <code class="ruby"> end</code>
585
- </li>
586
-
587
- <li class="never" data-hits="" data-linenumber="64">
588
-
589
-
590
- <code class="ruby"> end</code>
591
- </li>
592
-
593
- <li class="never" data-hits="" data-linenumber="65">
594
-
595
-
596
- <code class="ruby"></code>
597
- </li>
598
-
599
- <li class="covered" data-hits="1" data-linenumber="66">
600
- <span class="hits">1</span>
601
-
602
- <code class="ruby"> def check_described_class(node, first_arg)</code>
603
- </li>
604
-
605
- <li class="covered" data-hits="6" data-linenumber="67">
606
- <span class="hits">6</span>
607
-
608
- <code class="ruby"> if !first_arg || first_arg.type != :const</code>
609
- </li>
610
-
611
- <li class="covered" data-hits="2" data-linenumber="68">
612
- <span class="hits">2</span>
613
-
614
- <code class="ruby"> add_offence(first_arg || node, :expression, DESCRIBE_CLASS_MSG)</code>
615
- </li>
616
-
617
- <li class="never" data-hits="" data-linenumber="69">
618
-
619
-
620
- <code class="ruby"> end</code>
621
- </li>
622
-
623
- <li class="never" data-hits="" data-linenumber="70">
624
-
625
-
626
- <code class="ruby"> end</code>
627
- </li>
628
-
629
- <li class="never" data-hits="" data-linenumber="71">
630
-
631
-
632
- <code class="ruby"></code>
633
- </li>
634
-
635
- <li class="covered" data-hits="1" data-linenumber="72">
636
- <span class="hits">1</span>
637
-
638
- <code class="ruby"> def check_described_method(node, second_arg)</code>
639
- </li>
640
-
641
- <li class="covered" data-hits="6" data-linenumber="73">
642
- <span class="hits">6</span>
643
-
644
- <code class="ruby"> return unless second_arg</code>
645
- </li>
646
-
647
- <li class="never" data-hits="" data-linenumber="74">
648
-
649
-
650
- <code class="ruby"></code>
651
- </li>
652
-
653
- <li class="covered" data-hits="3" data-linenumber="75">
654
- <span class="hits">3</span>
655
-
656
- <code class="ruby"> unless METHOD_STRING_MATCHER =~ second_arg.children.first</code>
657
- </li>
658
-
659
- <li class="covered" data-hits="1" data-linenumber="76">
660
- <span class="hits">1</span>
661
-
662
- <code class="ruby"> add_offence(second_arg, :expression, METHOD_STRING_MSG)</code>
663
- </li>
664
-
665
- <li class="never" data-hits="" data-linenumber="77">
666
-
667
-
668
- <code class="ruby"> end</code>
669
- </li>
670
-
671
- <li class="never" data-hits="" data-linenumber="78">
672
-
673
-
674
- <code class="ruby"> end</code>
675
- </li>
676
-
677
- <li class="never" data-hits="" data-linenumber="79">
678
-
679
-
680
- <code class="ruby"></code>
681
- </li>
682
-
683
- <li class="covered" data-hits="1" data-linenumber="80">
684
- <span class="hits">1</span>
685
-
686
- <code class="ruby"> def check_class_spec(node, path_parts)</code>
687
- </li>
688
-
689
- <li class="covered" data-hits="5" data-linenumber="81">
690
- <span class="hits">5</span>
691
-
692
- <code class="ruby"> spec_path = File.join(path_parts) + &#39;_spec.rb&#39;</code>
693
- </li>
694
-
695
- <li class="covered" data-hits="5" data-linenumber="82">
696
- <span class="hits">5</span>
697
-
698
- <code class="ruby"> unless source_filename.end_with? spec_path</code>
699
- </li>
700
-
701
- <li class="covered" data-hits="1" data-linenumber="83">
702
- <span class="hits">1</span>
703
-
704
- <code class="ruby"> add_offence(node, :expression, format(CLASS_SPEC_MSG, spec_path))</code>
705
- </li>
706
-
707
- <li class="never" data-hits="" data-linenumber="84">
708
-
709
-
710
- <code class="ruby"> end</code>
711
- </li>
712
-
713
- <li class="never" data-hits="" data-linenumber="85">
714
-
715
-
716
- <code class="ruby"> end</code>
717
- </li>
718
-
719
- <li class="never" data-hits="" data-linenumber="86">
720
-
721
-
722
- <code class="ruby"></code>
723
- </li>
724
-
725
- <li class="covered" data-hits="1" data-linenumber="87">
726
- <span class="hits">1</span>
727
-
728
- <code class="ruby"> def check_method_spec(node, path_parts, method_str)</code>
729
- </li>
730
-
731
- <li class="covered" data-hits="6" data-linenumber="88">
732
- <span class="hits">6</span>
733
-
734
- <code class="ruby"> matcher_parts = path_parts.dup</code>
735
- </li>
736
-
737
- <li class="never" data-hits="" data-linenumber="89">
738
-
739
-
740
- <code class="ruby"> # Strip out symbols; it&#39;s not worth enforcing a vocabulary for them.</code>
741
- </li>
742
-
743
- <li class="covered" data-hits="6" data-linenumber="90">
744
- <span class="hits">6</span>
745
-
746
- <code class="ruby"> matcher_parts &lt;&lt; method_str[1..-1].gsub(/\W+/, &#39;*&#39;) + &#39;_spec.rb&#39;</code>
747
- </li>
748
-
749
- <li class="never" data-hits="" data-linenumber="91">
750
-
751
-
752
- <code class="ruby"></code>
753
- </li>
754
-
755
- <li class="covered" data-hits="6" data-linenumber="92">
756
- <span class="hits">6</span>
757
-
758
- <code class="ruby"> glob_matcher = File.join(matcher_parts)</code>
759
- </li>
760
-
761
- <li class="covered" data-hits="6" data-linenumber="93">
762
- <span class="hits">6</span>
763
-
764
- <code class="ruby"> unless source_filename =~ regexp_from_glob(glob_matcher)</code>
765
- </li>
766
-
767
- <li class="covered" data-hits="1" data-linenumber="94">
768
- <span class="hits">1</span>
769
-
770
- <code class="ruby"> message = format(METHOD_SPEC_MSG, glob_matcher)</code>
771
- </li>
772
-
773
- <li class="covered" data-hits="1" data-linenumber="95">
774
- <span class="hits">1</span>
775
-
776
- <code class="ruby"> add_offence(node, :expression, message)</code>
777
- </li>
778
-
779
- <li class="never" data-hits="" data-linenumber="96">
780
-
781
-
782
- <code class="ruby"> end</code>
783
- </li>
784
-
785
- <li class="never" data-hits="" data-linenumber="97">
786
-
787
-
788
- <code class="ruby"> end</code>
789
- </li>
790
-
791
- <li class="never" data-hits="" data-linenumber="98">
792
-
793
-
794
- <code class="ruby"></code>
795
- </li>
796
-
797
- <li class="covered" data-hits="1" data-linenumber="99">
798
- <span class="hits">1</span>
799
-
800
- <code class="ruby"> def top_level_describe?(node)</code>
801
- </li>
802
-
803
- <li class="covered" data-hits="20" data-linenumber="100">
804
- <span class="hits">20</span>
805
-
806
- <code class="ruby"> _receiver, method_name, *_args = *node</code>
807
- </li>
808
-
809
- <li class="covered" data-hits="20" data-linenumber="101">
810
- <span class="hits">20</span>
811
-
812
- <code class="ruby"> return false unless method_name == :describe</code>
813
- </li>
814
-
815
- <li class="never" data-hits="" data-linenumber="102">
816
-
817
-
818
- <code class="ruby"></code>
819
- </li>
820
-
821
- <li class="covered" data-hits="19" data-linenumber="103">
822
- <span class="hits">19</span>
823
-
824
- <code class="ruby"> root_node = processed_source.ast</code>
825
- </li>
826
-
827
- <li class="covered" data-hits="19" data-linenumber="104">
828
- <span class="hits">19</span>
829
-
830
- <code class="ruby"> top_level_nodes = describe_statement_children(root_node)</code>
831
- </li>
832
-
833
- <li class="never" data-hits="" data-linenumber="105">
834
-
835
-
836
- <code class="ruby"> # If we have no top level describe statements, we need to check any</code>
837
- </li>
838
-
839
- <li class="never" data-hits="" data-linenumber="106">
840
-
841
-
842
- <code class="ruby"> # blocks on the top level (e.g. after a require).</code>
843
- </li>
844
-
845
- <li class="covered" data-hits="19" data-linenumber="107">
846
- <span class="hits">19</span>
847
-
848
- <code class="ruby"> if top_level_nodes.size == 0</code>
849
- </li>
850
-
851
- <li class="covered" data-hits="2" data-linenumber="108">
852
- <span class="hits">2</span>
853
-
854
- <code class="ruby"> top_level_nodes = node_children(root_node).map do |child|</code>
855
- </li>
856
-
857
- <li class="covered" data-hits="3" data-linenumber="109">
858
- <span class="hits">3</span>
859
-
860
- <code class="ruby"> describe_statement_children(child) if child.type == :block</code>
861
- </li>
862
-
863
- <li class="never" data-hits="" data-linenumber="110">
864
-
865
-
866
- <code class="ruby"> end.flatten.compact</code>
867
- </li>
868
-
869
- <li class="never" data-hits="" data-linenumber="111">
870
-
871
-
872
- <code class="ruby"> end</code>
873
- </li>
874
-
875
- <li class="never" data-hits="" data-linenumber="112">
876
-
877
-
878
- <code class="ruby"></code>
879
- </li>
880
-
881
- <li class="covered" data-hits="19" data-linenumber="113">
882
- <span class="hits">19</span>
883
-
884
- <code class="ruby"> top_level_nodes.include? node</code>
885
- </li>
886
-
887
- <li class="never" data-hits="" data-linenumber="114">
888
-
889
-
890
- <code class="ruby"> end</code>
891
- </li>
892
-
893
- <li class="never" data-hits="" data-linenumber="115">
894
-
895
-
896
- <code class="ruby"></code>
897
- </li>
898
-
899
- <li class="covered" data-hits="1" data-linenumber="116">
900
- <span class="hits">1</span>
901
-
902
- <code class="ruby"> def describe_statement_children(node)</code>
903
- </li>
904
-
905
- <li class="covered" data-hits="20" data-linenumber="117">
906
- <span class="hits">20</span>
907
-
908
- <code class="ruby"> node_children(node).select do |element|</code>
909
- </li>
910
-
911
- <li class="covered" data-hits="41" data-linenumber="118">
912
- <span class="hits">41</span>
913
-
914
- <code class="ruby"> element.type == :send &amp;&amp; element.children[1] == :describe</code>
915
- </li>
916
-
917
- <li class="never" data-hits="" data-linenumber="119">
918
-
919
-
920
- <code class="ruby"> end</code>
921
- </li>
922
-
923
- <li class="never" data-hits="" data-linenumber="120">
924
-
925
-
926
- <code class="ruby"> end</code>
927
- </li>
928
-
929
- <li class="never" data-hits="" data-linenumber="121">
930
-
931
-
932
- <code class="ruby"></code>
933
- </li>
934
-
935
- <li class="covered" data-hits="1" data-linenumber="122">
936
- <span class="hits">1</span>
937
-
938
- <code class="ruby"> def source_filename</code>
939
- </li>
940
-
941
- <li class="covered" data-hits="11" data-linenumber="123">
942
- <span class="hits">11</span>
943
-
944
- <code class="ruby"> processed_source.buffer.name</code>
945
- </li>
946
-
947
- <li class="never" data-hits="" data-linenumber="124">
948
-
949
-
950
- <code class="ruby"> end</code>
951
- </li>
952
-
953
- <li class="never" data-hits="" data-linenumber="125">
954
-
955
-
956
- <code class="ruby"></code>
957
- </li>
958
-
959
- <li class="covered" data-hits="1" data-linenumber="126">
960
- <span class="hits">1</span>
961
-
962
- <code class="ruby"> def camel_to_underscore(string)</code>
963
- </li>
964
-
965
- <li class="covered" data-hits="17" data-linenumber="127">
966
- <span class="hits">17</span>
967
-
968
- <code class="ruby"> string.dup.tap do |result|</code>
969
- </li>
970
-
971
- <li class="covered" data-hits="17" data-linenumber="128">
972
- <span class="hits">17</span>
973
-
974
- <code class="ruby"> result.gsub!(/([^A-Z])([A-Z]+)/, &#39;\\1_\\2&#39;)</code>
975
- </li>
976
-
977
- <li class="covered" data-hits="17" data-linenumber="129">
978
- <span class="hits">17</span>
979
-
980
- <code class="ruby"> result.gsub!(/([A-Z]+)([A-Z][^A-Z]+)/, &#39;\\1_\\2&#39;)</code>
981
- </li>
982
-
983
- <li class="covered" data-hits="17" data-linenumber="130">
984
- <span class="hits">17</span>
985
-
986
- <code class="ruby"> result.downcase!</code>
987
- </li>
988
-
989
- <li class="never" data-hits="" data-linenumber="131">
990
-
991
-
992
- <code class="ruby"> end</code>
993
- </li>
994
-
995
- <li class="never" data-hits="" data-linenumber="132">
996
-
997
-
998
- <code class="ruby"> end</code>
999
- </li>
1000
-
1001
- <li class="never" data-hits="" data-linenumber="133">
1002
-
1003
-
1004
- <code class="ruby"></code>
1005
- </li>
1006
-
1007
- <li class="covered" data-hits="1" data-linenumber="134">
1008
- <span class="hits">1</span>
1009
-
1010
- <code class="ruby"> def regexp_from_glob(glob)</code>
1011
- </li>
1012
-
1013
- <li class="covered" data-hits="6" data-linenumber="135">
1014
- <span class="hits">6</span>
1015
-
1016
- <code class="ruby"> Regexp.new(glob.gsub(&#39;.&#39;, &#39;\\.&#39;).gsub(&#39;*&#39;, &#39;.*&#39;) + &#39;$&#39;)</code>
1017
- </li>
1018
-
1019
- <li class="never" data-hits="" data-linenumber="136">
1020
-
1021
-
1022
- <code class="ruby"> end</code>
1023
- </li>
1024
-
1025
- <li class="never" data-hits="" data-linenumber="137">
1026
-
1027
-
1028
- <code class="ruby"></code>
1029
- </li>
1030
-
1031
- <li class="covered" data-hits="1" data-linenumber="138">
1032
- <span class="hits">1</span>
1033
-
1034
- <code class="ruby"> def node_children(node)</code>
1035
- </li>
1036
-
1037
- <li class="covered" data-hits="86" data-linenumber="139">
1038
- <span class="hits">86</span>
1039
-
1040
- <code class="ruby"> node.children.select { |e| e.is_a? Parser::AST::Node }</code>
1041
- </li>
1042
-
1043
- <li class="never" data-hits="" data-linenumber="140">
1044
-
1045
-
1046
- <code class="ruby"> end</code>
1047
- </li>
1048
-
1049
- <li class="never" data-hits="" data-linenumber="141">
1050
-
1051
-
1052
- <code class="ruby"> end</code>
1053
- </li>
1054
-
1055
- <li class="never" data-hits="" data-linenumber="142">
1056
-
1057
-
1058
- <code class="ruby"> end</code>
1059
- </li>
1060
-
1061
- <li class="never" data-hits="" data-linenumber="143">
1062
-
1063
-
1064
- <code class="ruby"> end</code>
1065
- </li>
1066
-
1067
- <li class="never" data-hits="" data-linenumber="144">
1068
-
1069
-
1070
- <code class="ruby">end</code>
1071
- </li>
1072
-
1073
- </ol>
1074
- </pre>
1075
- </div>
1076
-
1077
- <div class="source_table" id="ed32ac750f248391bff2e2fec5aa10d4c722b8f6">
1078
- <div class="header">
1079
- <h3>lib/rubocop/rspec/inject.rb</h3>
1080
- <h4><span class="green">100.0 %</span> covered</h4>
1081
- <div>
1082
- <b>10</b> relevant lines.
1083
- <span class="green"><b>10</b> lines covered</span> and
1084
- <span class="red"><b>0</b> lines missed.</span>
1085
- </div>
1086
- </div>
1087
-
1088
- <pre>
1089
- <ol>
1090
-
1091
- <li class="covered" data-hits="1" data-linenumber="1">
1092
- <span class="hits">1</span>
1093
-
1094
- <code class="ruby">require &#39;yaml&#39;</code>
1095
- </li>
1096
-
1097
- <li class="never" data-hits="" data-linenumber="2">
1098
-
1099
-
1100
- <code class="ruby"></code>
1101
- </li>
1102
-
1103
- <li class="covered" data-hits="1" data-linenumber="3">
1104
- <span class="hits">1</span>
1105
-
1106
- <code class="ruby">module Rubocop</code>
1107
- </li>
1108
-
1109
- <li class="covered" data-hits="1" data-linenumber="4">
1110
- <span class="hits">1</span>
1111
-
1112
- <code class="ruby"> module RSpec</code>
1113
- </li>
1114
-
1115
- <li class="never" data-hits="" data-linenumber="5">
1116
-
1117
-
1118
- <code class="ruby"> # Because RuboCop doesn&#39;t yet support plugins, we have to monkey patch in a</code>
1119
- </li>
1120
-
1121
- <li class="never" data-hits="" data-linenumber="6">
1122
-
1123
-
1124
- <code class="ruby"> # bit of our configuration.</code>
1125
- </li>
1126
-
1127
- <li class="covered" data-hits="1" data-linenumber="7">
1128
- <span class="hits">1</span>
1129
-
1130
- <code class="ruby"> module Inject</code>
1131
- </li>
1132
-
1133
- <li class="covered" data-hits="1" data-linenumber="8">
1134
- <span class="hits">1</span>
1135
-
1136
- <code class="ruby"> DEFAULT_FILE = File.expand_path(</code>
1137
- </li>
1138
-
1139
- <li class="never" data-hits="" data-linenumber="9">
1140
-
1141
-
1142
- <code class="ruby"> &#39;../../../../config/default.yml&#39;, __FILE__</code>
1143
- </li>
1144
-
1145
- <li class="never" data-hits="" data-linenumber="10">
1146
-
1147
-
1148
- <code class="ruby"> )</code>
1149
- </li>
1150
-
1151
- <li class="never" data-hits="" data-linenumber="11">
1152
-
1153
-
1154
- <code class="ruby"></code>
1155
- </li>
1156
-
1157
- <li class="covered" data-hits="1" data-linenumber="12">
1158
- <span class="hits">1</span>
1159
-
1160
- <code class="ruby"> def self.defaults!</code>
1161
- </li>
1162
-
1163
- <li class="covered" data-hits="1" data-linenumber="13">
1164
- <span class="hits">1</span>
1165
-
1166
- <code class="ruby"> hash = YAML.load_file(DEFAULT_FILE)</code>
1167
- </li>
1168
-
1169
- <li class="covered" data-hits="1" data-linenumber="14">
1170
- <span class="hits">1</span>
1171
-
1172
- <code class="ruby"> puts &quot;configuration from #{path}&quot; if ConfigLoader.debug?</code>
1173
- </li>
1174
-
1175
- <li class="covered" data-hits="1" data-linenumber="15">
1176
- <span class="hits">1</span>
1177
-
1178
- <code class="ruby"> config = ConfigLoader.merge_with_default(hash, DEFAULT_FILE)</code>
1179
- </li>
1180
-
1181
- <li class="never" data-hits="" data-linenumber="16">
1182
-
1183
-
1184
- <code class="ruby"></code>
1185
- </li>
1186
-
1187
- <li class="covered" data-hits="1" data-linenumber="17">
1188
- <span class="hits">1</span>
1189
-
1190
- <code class="ruby"> ConfigLoader.instance_variable_set(:@default_configuration, config)</code>
1191
- </li>
1192
-
1193
- <li class="never" data-hits="" data-linenumber="18">
1194
-
1195
-
1196
- <code class="ruby"> end</code>
1197
- </li>
1198
-
1199
- <li class="never" data-hits="" data-linenumber="19">
1200
-
1201
-
1202
- <code class="ruby"> end</code>
1203
- </li>
1204
-
1205
- <li class="never" data-hits="" data-linenumber="20">
1206
-
1207
-
1208
- <code class="ruby"> end</code>
1209
- </li>
1210
-
1211
- <li class="never" data-hits="" data-linenumber="21">
1212
-
1213
-
1214
- <code class="ruby">end</code>
1215
- </li>
1216
-
1217
- </ol>
1218
- </pre>
1219
- </div>
1220
-
1221
- </div>
1222
- </div>
1223
- </body>
1224
- </html>