dfect 1.1.0 → 2.0.0

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