caricature 0.5.0 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/caricature.gemspec +5 -2
- data/doc/Array.html +2 -2
- data/doc/Caricature/ArgumentRecording.html +4 -4
- data/doc/Caricature/ClrClassMessenger.html +22 -22
- data/doc/Caricature/ClrInterfaceMessenger.html +19 -19
- data/doc/Caricature/ClrIsolator.html +1 -1
- data/doc/Caricature/Expectation.html +12 -12
- data/doc/Caricature/ExpectationBuilder.html +6 -6
- data/doc/Caricature/ExpectationSyntax.html +10 -10
- data/doc/Caricature/Expectations.html +19 -16
- data/doc/Caricature/Interception/ClassMethods.html +120 -2
- data/doc/Caricature/Interception.html +130 -12
- data/doc/Caricature/Isolation.html +207 -22
- data/doc/Caricature/Isolator.html +18 -18
- data/doc/Caricature/Messenger.html +87 -9
- data/doc/Caricature/MethodCallRecorder.html +20 -56
- data/doc/Caricature/MethodCallRecording.html +10 -10
- data/doc/Caricature/RubyIsolator.html +13 -13
- data/doc/Caricature/RubyMessenger.html +24 -23
- data/doc/Caricature/RubyObjectDescriptor.html +4 -4
- data/doc/Caricature/TypeDescriptor.html +4 -4
- data/doc/Caricature/Verification.html +16 -16
- data/doc/Caricature.html +2 -2
- data/doc/Class.html +4 -4
- data/doc/Hash.html +2 -2
- data/doc/Module.html +4 -4
- data/doc/Object.html +6 -6
- data/doc/String.html +4 -4
- data/doc/System/String.html +4 -4
- data/doc/System/Type.html +4 -4
- data/doc/created.rid +1 -1
- data/doc/index.html +102 -82
- data/doc/lib/caricature/clr/isolator_rb.html +1 -1
- data/doc/lib/caricature/clr/messenger_rb.html +1 -1
- data/doc/lib/caricature/clr_rb.html +1 -1
- data/doc/lib/caricature/expectation_rb.html +1 -1
- data/doc/lib/caricature/isolation_rb.html +1 -1
- data/doc/lib/caricature/isolator_rb.html +1 -1
- data/doc/lib/caricature/messenger_rb.html +52 -0
- data/doc/lib/caricature/method_call_recorder_rb.html +1 -1
- data/doc/lib/caricature/verification_rb.html +1 -1
- data/doc/lib/caricature_rb.html +1 -1
- data/lib/caricature/clr/aspnet_mvc.rb +51 -0
- data/lib/caricature/clr/isolator.rb +2 -1
- data/lib/caricature/expectation.rb +4 -3
- data/lib/caricature/method_call_recorder.rb +2 -2
- data/lib/caricature/verification.rb +1 -1
- data/pkg/caricature-0.5.0.gem +0 -0
- data/spec/isolator_spec.rb +7 -1
- metadata +5 -2
@@ -64,17 +64,27 @@
|
|
64
64
|
|
65
65
|
<li><a href="#M000001">::for</a></li>
|
66
66
|
|
67
|
-
<li><a href="#
|
67
|
+
<li><a href="#M000047">::for</a></li>
|
68
68
|
|
69
69
|
<li><a href="#M000002">::get_clr_isolation_strategy</a></li>
|
70
70
|
|
71
|
-
<li><a href="#
|
71
|
+
<li><a href="#M000034">::new</a></li>
|
72
|
+
|
73
|
+
<li><a href="#M000045">#class_verify</a></li>
|
74
|
+
|
75
|
+
<li><a href="#M000043">#create_class_override</a></li>
|
72
76
|
|
73
77
|
<li><a href="#M000041">#create_override</a></li>
|
74
78
|
|
75
|
-
<li><a href="#
|
79
|
+
<li><a href="#M000049">#internal_create_override</a></li>
|
80
|
+
|
81
|
+
<li><a href="#M000051">#internal_verify</a></li>
|
82
|
+
|
83
|
+
<li><a href="#M000039">#send_class_message</a></li>
|
84
|
+
|
85
|
+
<li><a href="#M000038">#send_message</a></li>
|
76
86
|
|
77
|
-
<li><a href="#
|
87
|
+
<li><a href="#M000044">#verify</a></li>
|
78
88
|
|
79
89
|
</ul>
|
80
90
|
</div>
|
@@ -317,7 +327,7 @@ the method call recorder
|
|
317
327
|
|
318
328
|
|
319
329
|
<div id="for-method" class="method-detail ">
|
320
|
-
<a name="
|
330
|
+
<a name="M000047"></a>
|
321
331
|
|
322
332
|
<div class="method-heading">
|
323
333
|
|
@@ -340,7 +350,7 @@ the method call recorder
|
|
340
350
|
<div class="method-source-code"
|
341
351
|
id="for-source">
|
342
352
|
<pre>
|
343
|
-
<span class="ruby-comment cmt"># File lib/caricature/isolation.rb, line
|
353
|
+
<span class="ruby-comment cmt"># File lib/caricature/isolation.rb, line 113</span>
|
344
354
|
<span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">for</span>(<span class="ruby-identifier">subject</span>, <span class="ruby-identifier">recorder</span> = <span class="ruby-constant">MethodCallRecorder</span>.<span class="ruby-identifier">new</span>, <span class="ruby-identifier">expectations</span> = <span class="ruby-constant">Expectations</span>.<span class="ruby-identifier">new</span>)
|
345
355
|
<span class="ruby-identifier">context</span> = <span class="ruby-constant">IsolatorContext</span>.<span class="ruby-identifier">new</span> <span class="ruby-identifier">subject</span>, <span class="ruby-identifier">recorder</span>, <span class="ruby-identifier">expectations</span>
|
346
356
|
|
@@ -357,7 +367,7 @@ the method call recorder
|
|
357
367
|
|
358
368
|
|
359
369
|
<div id="new-method" class="method-detail ">
|
360
|
-
<a name="
|
370
|
+
<a name="M000034"></a>
|
361
371
|
|
362
372
|
<div class="method-heading">
|
363
373
|
|
@@ -384,7 +394,6 @@ Initializes a new instance of this isolation.
|
|
384
394
|
<span class="ruby-ivar">@recorder</span> = <span class="ruby-identifier">context</span>.<span class="ruby-identifier">recorder</span>
|
385
395
|
<span class="ruby-ivar">@messenger</span> = <span class="ruby-identifier">context</span>.<span class="ruby-identifier">messenger</span>
|
386
396
|
<span class="ruby-ivar">@expectations</span> = <span class="ruby-identifier">context</span>.<span class="ruby-identifier">expectations</span>
|
387
|
-
<span class="ruby-comment cmt"># isolator.isolation.instance_variable_set("@___context___", self)</span>
|
388
397
|
<span class="ruby-identifier">isolator</span>.<span class="ruby-identifier">isolation</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">instance_variable_set</span>(<span class="ruby-value str">"@___context___"</span>, <span class="ruby-keyword kw">self</span>)
|
389
398
|
<span class="ruby-keyword kw">end</span></pre>
|
390
399
|
</div>
|
@@ -444,6 +453,76 @@ otherwise it will return a <tt>ClrIsolator</tt>
|
|
444
453
|
<h3 class="section-header">Public Instance Methods</h3>
|
445
454
|
|
446
455
|
|
456
|
+
<div id="class-verify-method" class="method-detail ">
|
457
|
+
<a name="M000045"></a>
|
458
|
+
|
459
|
+
<div class="method-heading">
|
460
|
+
|
461
|
+
<span class="method-name">class_verify</span><span
|
462
|
+
class="method-args">(method_name, &block)</span>
|
463
|
+
<span class="method-click-advice">click to toggle source</span>
|
464
|
+
|
465
|
+
</div>
|
466
|
+
|
467
|
+
<div class="method-description">
|
468
|
+
|
469
|
+
<p>
|
470
|
+
asserts whether the method has been called for the specified configuration
|
471
|
+
</p>
|
472
|
+
|
473
|
+
|
474
|
+
|
475
|
+
<div class="method-source-code"
|
476
|
+
id="class-verify-source">
|
477
|
+
<pre>
|
478
|
+
<span class="ruby-comment cmt"># File lib/caricature/isolation.rb, line 104</span>
|
479
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">class_verify</span>(<span class="ruby-identifier">method_name</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">block</span>)
|
480
|
+
<span class="ruby-identifier">internal_verify</span> <span class="ruby-identifier">method_name</span>, <span class="ruby-identifier">:class</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">block</span>
|
481
|
+
<span class="ruby-keyword kw">end</span></pre>
|
482
|
+
</div>
|
483
|
+
|
484
|
+
</div>
|
485
|
+
|
486
|
+
|
487
|
+
</div>
|
488
|
+
|
489
|
+
|
490
|
+
<div id="create-class-override-method" class="method-detail ">
|
491
|
+
<a name="M000043"></a>
|
492
|
+
|
493
|
+
<div class="method-heading">
|
494
|
+
|
495
|
+
<span class="method-name">create_class_override</span><span
|
496
|
+
class="method-args">(method_name, &block)</span>
|
497
|
+
<span class="method-click-advice">click to toggle source</span>
|
498
|
+
|
499
|
+
</div>
|
500
|
+
|
501
|
+
<div class="method-description">
|
502
|
+
|
503
|
+
<p>
|
504
|
+
builds up an expectation for a class method, allows for overriding the
|
505
|
+
result returned by the class method
|
506
|
+
</p>
|
507
|
+
|
508
|
+
|
509
|
+
|
510
|
+
<div class="method-source-code"
|
511
|
+
id="create-class-override-source">
|
512
|
+
<pre>
|
513
|
+
<span class="ruby-comment cmt"># File lib/caricature/isolation.rb, line 93</span>
|
514
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">create_class_override</span>(<span class="ruby-identifier">method_name</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">block</span>)
|
515
|
+
<span class="ruby-identifier">puts</span> <span class="ruby-value str">"creating override"</span>
|
516
|
+
<span class="ruby-identifier">internal_create_override</span> <span class="ruby-identifier">method_name</span>, <span class="ruby-identifier">:class</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">block</span>
|
517
|
+
<span class="ruby-keyword kw">end</span></pre>
|
518
|
+
</div>
|
519
|
+
|
520
|
+
</div>
|
521
|
+
|
522
|
+
|
523
|
+
</div>
|
524
|
+
|
525
|
+
|
447
526
|
<div id="create-override-method" class="method-detail ">
|
448
527
|
<a name="M000041"></a>
|
449
528
|
|
@@ -458,8 +537,8 @@ otherwise it will return a <tt>ClrIsolator</tt>
|
|
458
537
|
<div class="method-description">
|
459
538
|
|
460
539
|
<p>
|
461
|
-
builds up an expectation, allows for overriding the
|
462
|
-
method
|
540
|
+
builds up an expectation for an instance method, allows for overriding the
|
541
|
+
result returned by the method
|
463
542
|
</p>
|
464
543
|
|
465
544
|
|
@@ -467,13 +546,9 @@ method
|
|
467
546
|
<div class="method-source-code"
|
468
547
|
id="create-override-source">
|
469
548
|
<pre>
|
470
|
-
<span class="ruby-comment cmt"># File lib/caricature/isolation.rb, line
|
549
|
+
<span class="ruby-comment cmt"># File lib/caricature/isolation.rb, line 88</span>
|
471
550
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">create_override</span>(<span class="ruby-identifier">method_name</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">block</span>)
|
472
|
-
<span class="ruby-identifier">
|
473
|
-
<span class="ruby-identifier">block</span>.<span class="ruby-identifier">call</span> <span class="ruby-identifier">builder</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">block</span>.<span class="ruby-identifier">nil?</span>
|
474
|
-
<span class="ruby-identifier">exp</span> = <span class="ruby-identifier">builder</span>.<span class="ruby-identifier">build</span>
|
475
|
-
<span class="ruby-identifier">expectations</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">exp</span>
|
476
|
-
<span class="ruby-identifier">exp</span>
|
551
|
+
<span class="ruby-identifier">internal_create_override</span> <span class="ruby-identifier">method_name</span>, <span class="ruby-identifier">:instance</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">block</span>
|
477
552
|
<span class="ruby-keyword kw">end</span></pre>
|
478
553
|
</div>
|
479
554
|
|
@@ -483,9 +558,45 @@ method
|
|
483
558
|
</div>
|
484
559
|
|
485
560
|
|
486
|
-
<div id="send-message-method" class="method-detail ">
|
561
|
+
<div id="send-class-message-method" class="method-detail ">
|
487
562
|
<a name="M000039"></a>
|
488
563
|
|
564
|
+
<div class="method-heading">
|
565
|
+
|
566
|
+
<span class="method-name">send_class_message</span><span
|
567
|
+
class="method-args">(method_name, return_type, *args, &b)</span>
|
568
|
+
<span class="method-click-advice">click to toggle source</span>
|
569
|
+
|
570
|
+
</div>
|
571
|
+
|
572
|
+
<div class="method-description">
|
573
|
+
|
574
|
+
<p>
|
575
|
+
record and send the message to the isolation. takes care of following
|
576
|
+
expectations rules when sending messages.
|
577
|
+
</p>
|
578
|
+
|
579
|
+
|
580
|
+
|
581
|
+
<div class="method-source-code"
|
582
|
+
id="send-class-message-source">
|
583
|
+
<pre>
|
584
|
+
<span class="ruby-comment cmt"># File lib/caricature/isolation.rb, line 82</span>
|
585
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">send_class_message</span>(<span class="ruby-identifier">method_name</span>, <span class="ruby-identifier">return_type</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">args</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">b</span>)
|
586
|
+
<span class="ruby-identifier">recorder</span>.<span class="ruby-identifier">record_call</span> <span class="ruby-identifier">method_name</span>, <span class="ruby-identifier">:class</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">args</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">b</span>
|
587
|
+
<span class="ruby-ivar">@messenger</span>.<span class="ruby-identifier">deliver_to_class</span>(<span class="ruby-identifier">method_name</span>, <span class="ruby-identifier">return_type</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">args</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">b</span>)
|
588
|
+
<span class="ruby-keyword kw">end</span></pre>
|
589
|
+
</div>
|
590
|
+
|
591
|
+
</div>
|
592
|
+
|
593
|
+
|
594
|
+
</div>
|
595
|
+
|
596
|
+
|
597
|
+
<div id="send-message-method" class="method-detail ">
|
598
|
+
<a name="M000038"></a>
|
599
|
+
|
489
600
|
<div class="method-heading">
|
490
601
|
|
491
602
|
<span class="method-name">send_message</span><span
|
@@ -506,9 +617,9 @@ expectations rules when sending messages.
|
|
506
617
|
<div class="method-source-code"
|
507
618
|
id="send-message-source">
|
508
619
|
<pre>
|
509
|
-
<span class="ruby-comment cmt"># File lib/caricature/isolation.rb, line
|
620
|
+
<span class="ruby-comment cmt"># File lib/caricature/isolation.rb, line 75</span>
|
510
621
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">send_message</span>(<span class="ruby-identifier">method_name</span>, <span class="ruby-identifier">return_type</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">args</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">b</span>)
|
511
|
-
<span class="ruby-identifier">recorder</span>.<span class="ruby-identifier">record_call</span> <span class="ruby-identifier">method_name</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">args</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">b</span>
|
622
|
+
<span class="ruby-identifier">recorder</span>.<span class="ruby-identifier">record_call</span> <span class="ruby-identifier">method_name</span>, <span class="ruby-identifier">:instance</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">args</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">b</span>
|
512
623
|
<span class="ruby-ivar">@messenger</span>.<span class="ruby-identifier">deliver</span>(<span class="ruby-identifier">method_name</span>, <span class="ruby-identifier">return_type</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">args</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">b</span>)
|
513
624
|
<span class="ruby-keyword kw">end</span></pre>
|
514
625
|
</div>
|
@@ -520,7 +631,7 @@ expectations rules when sending messages.
|
|
520
631
|
|
521
632
|
|
522
633
|
<div id="verify-method" class="method-detail ">
|
523
|
-
<a name="
|
634
|
+
<a name="M000044"></a>
|
524
635
|
|
525
636
|
<div class="method-heading">
|
526
637
|
|
@@ -541,9 +652,83 @@ asserts whether the method has been called for the specified configuration
|
|
541
652
|
<div class="method-source-code"
|
542
653
|
id="verify-source">
|
543
654
|
<pre>
|
544
|
-
<span class="ruby-comment cmt"># File lib/caricature/isolation.rb, line
|
655
|
+
<span class="ruby-comment cmt"># File lib/caricature/isolation.rb, line 99</span>
|
545
656
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">verify</span>(<span class="ruby-identifier">method_name</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">block</span>)
|
546
|
-
<span class="ruby-identifier">
|
657
|
+
<span class="ruby-identifier">internal_verify</span> <span class="ruby-identifier">method_name</span>, <span class="ruby-identifier">:instance</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">block</span>
|
658
|
+
<span class="ruby-keyword kw">end</span></pre>
|
659
|
+
</div>
|
660
|
+
|
661
|
+
</div>
|
662
|
+
|
663
|
+
|
664
|
+
</div>
|
665
|
+
|
666
|
+
|
667
|
+
</div>
|
668
|
+
|
669
|
+
<div id="protected-instance-method-details" class="method-section section">
|
670
|
+
<h3 class="section-header">Protected Instance Methods</h3>
|
671
|
+
|
672
|
+
|
673
|
+
<div id="internal-create-override-method" class="method-detail ">
|
674
|
+
<a name="M000049"></a>
|
675
|
+
|
676
|
+
<div class="method-heading">
|
677
|
+
|
678
|
+
<span class="method-name">internal_create_override</span><span
|
679
|
+
class="method-args">(method_name, mode=:instance, &block)</span>
|
680
|
+
<span class="method-click-advice">click to toggle source</span>
|
681
|
+
|
682
|
+
</div>
|
683
|
+
|
684
|
+
<div class="method-description">
|
685
|
+
|
686
|
+
<p class="missing-docs">(Not documented)</p>
|
687
|
+
|
688
|
+
|
689
|
+
|
690
|
+
<div class="method-source-code"
|
691
|
+
id="internal-create-override-source">
|
692
|
+
<pre>
|
693
|
+
<span class="ruby-comment cmt"># File lib/caricature/isolation.rb, line 125</span>
|
694
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">internal_create_override</span>(<span class="ruby-identifier">method_name</span>, <span class="ruby-identifier">mode</span>=<span class="ruby-identifier">:instance</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">block</span>)
|
695
|
+
<span class="ruby-identifier">builder</span> = <span class="ruby-constant">ExpectationBuilder</span>.<span class="ruby-identifier">new</span> <span class="ruby-identifier">method_name</span>
|
696
|
+
<span class="ruby-identifier">block</span>.<span class="ruby-identifier">call</span> <span class="ruby-identifier">builder</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">block</span>.<span class="ruby-identifier">nil?</span>
|
697
|
+
<span class="ruby-identifier">exp</span> = <span class="ruby-identifier">builder</span>.<span class="ruby-identifier">build</span>
|
698
|
+
<span class="ruby-identifier">expectations</span>.<span class="ruby-identifier">add_expectation</span> <span class="ruby-identifier">exp</span>, <span class="ruby-identifier">mode</span>
|
699
|
+
<span class="ruby-identifier">exp</span>
|
700
|
+
<span class="ruby-keyword kw">end</span></pre>
|
701
|
+
</div>
|
702
|
+
|
703
|
+
</div>
|
704
|
+
|
705
|
+
|
706
|
+
</div>
|
707
|
+
|
708
|
+
|
709
|
+
<div id="internal-verify-method" class="method-detail ">
|
710
|
+
<a name="M000051"></a>
|
711
|
+
|
712
|
+
<div class="method-heading">
|
713
|
+
|
714
|
+
<span class="method-name">internal_verify</span><span
|
715
|
+
class="method-args">(method_name, mode=:instance, &block)</span>
|
716
|
+
<span class="method-click-advice">click to toggle source</span>
|
717
|
+
|
718
|
+
</div>
|
719
|
+
|
720
|
+
<div class="method-description">
|
721
|
+
|
722
|
+
<p class="missing-docs">(Not documented)</p>
|
723
|
+
|
724
|
+
|
725
|
+
|
726
|
+
<div class="method-source-code"
|
727
|
+
id="internal-verify-source">
|
728
|
+
<pre>
|
729
|
+
<span class="ruby-comment cmt"># File lib/caricature/isolation.rb, line 133</span>
|
730
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">internal_verify</span>(<span class="ruby-identifier">method_name</span>, <span class="ruby-identifier">mode</span>=<span class="ruby-identifier">:instance</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">block</span>)
|
731
|
+
<span class="ruby-identifier">verification</span> = <span class="ruby-constant">Verification</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">method_name</span>, <span class="ruby-identifier">recorder</span>, <span class="ruby-identifier">mode</span>)
|
547
732
|
<span class="ruby-identifier">block</span>.<span class="ruby-identifier">call</span> <span class="ruby-identifier">verification</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">block</span>.<span class="ruby-identifier">nil?</span>
|
548
733
|
<span class="ruby-identifier">verification</span>
|
549
734
|
<span class="ruby-keyword kw">end</span></pre>
|
@@ -59,17 +59,17 @@
|
|
59
59
|
<h3 class="section-header">Methods</h3>
|
60
60
|
<ul class="link-list">
|
61
61
|
|
62
|
-
<li><a href="#
|
62
|
+
<li><a href="#M000072">::for</a></li>
|
63
63
|
|
64
|
-
<li><a href="#
|
64
|
+
<li><a href="#M000063">::new</a></li>
|
65
65
|
|
66
|
-
<li><a href="#
|
66
|
+
<li><a href="#M000065">#build_isolation</a></li>
|
67
67
|
|
68
|
-
<li><a href="#
|
68
|
+
<li><a href="#M000068">#class_name</a></li>
|
69
69
|
|
70
|
-
<li><a href="#
|
70
|
+
<li><a href="#M000069">#initialize_isolation</a></li>
|
71
71
|
|
72
|
-
<li><a href="#
|
72
|
+
<li><a href="#M000067">#initialize_messenger</a></li>
|
73
73
|
|
74
74
|
</ul>
|
75
75
|
</div>
|
@@ -269,7 +269,7 @@ holds the descriptor for this type of object
|
|
269
269
|
|
270
270
|
|
271
271
|
<div id="for-method" class="method-detail ">
|
272
|
-
<a name="
|
272
|
+
<a name="M000072"></a>
|
273
273
|
|
274
274
|
<div class="method-heading">
|
275
275
|
|
@@ -299,7 +299,7 @@ virtual in your implementing classes.
|
|
299
299
|
<div class="method-source-code"
|
300
300
|
id="for-source">
|
301
301
|
<pre>
|
302
|
-
<span class="ruby-comment cmt"># File lib/caricature/isolator.rb, line
|
302
|
+
<span class="ruby-comment cmt"># File lib/caricature/isolator.rb, line 219</span>
|
303
303
|
<span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">for</span>(<span class="ruby-identifier">context</span>)
|
304
304
|
<span class="ruby-identifier">context</span>.<span class="ruby-identifier">recorder</span> <span class="ruby-operator">||=</span> <span class="ruby-constant">MethodCallRecorder</span>.<span class="ruby-identifier">new</span>
|
305
305
|
<span class="ruby-identifier">context</span>.<span class="ruby-identifier">expectations</span> <span class="ruby-operator">||=</span> <span class="ruby-constant">Expectations</span>.<span class="ruby-identifier">new</span>
|
@@ -314,7 +314,7 @@ virtual in your implementing classes.
|
|
314
314
|
|
315
315
|
|
316
316
|
<div id="new-method" class="method-detail ">
|
317
|
-
<a name="
|
317
|
+
<a name="M000063"></a>
|
318
318
|
|
319
319
|
<div class="method-heading">
|
320
320
|
|
@@ -335,7 +335,7 @@ creates a new instance of an isolator
|
|
335
335
|
<div class="method-source-code"
|
336
336
|
id="new-source">
|
337
337
|
<pre>
|
338
|
-
<span class="ruby-comment cmt"># File lib/caricature/isolator.rb, line
|
338
|
+
<span class="ruby-comment cmt"># File lib/caricature/isolator.rb, line 177</span>
|
339
339
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">context</span>)
|
340
340
|
<span class="ruby-ivar">@context</span> = <span class="ruby-identifier">context</span>
|
341
341
|
<span class="ruby-keyword kw">end</span></pre>
|
@@ -354,7 +354,7 @@ creates a new instance of an isolator
|
|
354
354
|
|
355
355
|
|
356
356
|
<div id="build-isolation-method" class="method-detail ">
|
357
|
-
<a name="
|
357
|
+
<a name="M000065"></a>
|
358
358
|
|
359
359
|
<div class="method-heading">
|
360
360
|
|
@@ -375,7 +375,7 @@ builds up the isolation class instance
|
|
375
375
|
<div class="method-source-code"
|
376
376
|
id="build-isolation-source">
|
377
377
|
<pre>
|
378
|
-
<span class="ruby-comment cmt"># File lib/caricature/isolator.rb, line
|
378
|
+
<span class="ruby-comment cmt"># File lib/caricature/isolator.rb, line 182</span>
|
379
379
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">build_isolation</span>(<span class="ruby-identifier">klass</span>, <span class="ruby-identifier">inst</span>=<span class="ruby-keyword kw">nil</span>)
|
380
380
|
<span class="ruby-identifier">pxy</span> = <span class="ruby-identifier">create_isolation_for</span> <span class="ruby-identifier">klass</span>
|
381
381
|
<span class="ruby-ivar">@isolation</span> = <span class="ruby-identifier">pxy</span>.<span class="ruby-identifier">new</span>
|
@@ -391,7 +391,7 @@ builds up the isolation class instance
|
|
391
391
|
|
392
392
|
|
393
393
|
<div id="class-name-method" class="method-detail ">
|
394
|
-
<a name="
|
394
|
+
<a name="M000068"></a>
|
395
395
|
|
396
396
|
<div class="method-heading">
|
397
397
|
|
@@ -412,7 +412,7 @@ Creates the new class name for the isolation
|
|
412
412
|
<div class="method-source-code"
|
413
413
|
id="class-name-source">
|
414
414
|
<pre>
|
415
|
-
<span class="ruby-comment cmt"># File lib/caricature/isolator.rb, line
|
415
|
+
<span class="ruby-comment cmt"># File lib/caricature/isolator.rb, line 195</span>
|
416
416
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">class_name</span>(<span class="ruby-identifier">subj</span>)
|
417
417
|
<span class="ruby-identifier">nm</span> = <span class="ruby-identifier">subj</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">:class_eval</span>) <span class="ruby-operator">?</span> <span class="ruby-identifier">subj</span>.<span class="ruby-identifier">demodulize</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">subj</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">demodulize</span>
|
418
418
|
<span class="ruby-ivar">@class_name</span> = <span class="ruby-node">"#{nm}#{System::Guid.new_guid.to_string('n')}"</span>
|
@@ -427,7 +427,7 @@ Creates the new class name for the isolation
|
|
427
427
|
|
428
428
|
|
429
429
|
<div id="initialize-isolation-method" class="method-detail ">
|
430
|
-
<a name="
|
430
|
+
<a name="M000069"></a>
|
431
431
|
|
432
432
|
<div class="method-heading">
|
433
433
|
|
@@ -448,7 +448,7 @@ Sets up the necessary instance variables for the isolation
|
|
448
448
|
<div class="method-source-code"
|
449
449
|
id="initialize-isolation-source">
|
450
450
|
<pre>
|
451
|
-
<span class="ruby-comment cmt"># File lib/caricature/isolator.rb, line
|
451
|
+
<span class="ruby-comment cmt"># File lib/caricature/isolator.rb, line 202</span>
|
452
452
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize_isolation</span>(<span class="ruby-identifier">klass</span>, <span class="ruby-identifier">context</span>)
|
453
453
|
<span class="ruby-identifier">pxy</span> = <span class="ruby-identifier">klass</span>.<span class="ruby-identifier">new</span>
|
454
454
|
<span class="ruby-identifier">pxy</span>.<span class="ruby-identifier">instance_variable_set</span>(<span class="ruby-value str">"@___context___"</span>, <span class="ruby-identifier">context</span>)
|
@@ -463,7 +463,7 @@ Sets up the necessary instance variables for the isolation
|
|
463
463
|
|
464
464
|
|
465
465
|
<div id="initialize-messenger-method" class="method-detail ">
|
466
|
-
<a name="
|
466
|
+
<a name="M000067"></a>
|
467
467
|
|
468
468
|
<div class="method-heading">
|
469
469
|
|
@@ -484,7 +484,7 @@ initializes the messaging strategy for the isolator
|
|
484
484
|
<div class="method-source-code"
|
485
485
|
id="initialize-messenger-source">
|
486
486
|
<pre>
|
487
|
-
<span class="ruby-comment cmt"># File lib/caricature/isolator.rb, line
|
487
|
+
<span class="ruby-comment cmt"># File lib/caricature/isolator.rb, line 190</span>
|
488
488
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize_messenger</span>
|
489
489
|
<span class="ruby-identifier">raise</span> <span class="ruby-constant">NotImplementedError</span>
|
490
490
|
<span class="ruby-keyword kw">end</span></pre>
|
@@ -28,8 +28,8 @@
|
|
28
28
|
<div class="section-body">
|
29
29
|
<ul>
|
30
30
|
|
31
|
-
<li><a href="../lib/caricature/
|
32
|
-
class="thickbox" title="lib/caricature/
|
31
|
+
<li><a href="../lib/caricature/messenger_rb.html?TB_iframe=true&height=550&width=785"
|
32
|
+
class="thickbox" title="lib/caricature/messenger.rb">lib/caricature/messenger.rb</a></li>
|
33
33
|
|
34
34
|
</ul>
|
35
35
|
</div>
|
@@ -59,9 +59,13 @@
|
|
59
59
|
<h3 class="section-header">Methods</h3>
|
60
60
|
<ul class="link-list">
|
61
61
|
|
62
|
-
<li><a href="#
|
62
|
+
<li><a href="#M000055">::new</a></li>
|
63
63
|
|
64
|
-
<li><a href="#
|
64
|
+
<li><a href="#M000056">#deliver</a></li>
|
65
|
+
|
66
|
+
<li><a href="#M000058">#deliver_to_class</a></li>
|
67
|
+
|
68
|
+
<li><a href="#M000059">#internal_deliver</a></li>
|
65
69
|
|
66
70
|
</ul>
|
67
71
|
</div>
|
@@ -239,7 +243,7 @@ the expecations that have been set for the isolation
|
|
239
243
|
|
240
244
|
|
241
245
|
<div id="new-method" class="method-detail ">
|
242
|
-
<a name="
|
246
|
+
<a name="M000055"></a>
|
243
247
|
|
244
248
|
<div class="method-heading">
|
245
249
|
|
@@ -260,7 +264,7 @@ creates a new instance of this messaging strategy
|
|
260
264
|
<div class="method-source-code"
|
261
265
|
id="new-source">
|
262
266
|
<pre>
|
263
|
-
<span class="ruby-comment cmt"># File lib/caricature/
|
267
|
+
<span class="ruby-comment cmt"># File lib/caricature/messenger.rb, line 14</span>
|
264
268
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">expectations</span>, <span class="ruby-identifier">instance</span>=<span class="ruby-keyword kw">nil</span>)
|
265
269
|
<span class="ruby-ivar">@instance</span>, <span class="ruby-ivar">@expectations</span> = <span class="ruby-identifier">instance</span>, <span class="ruby-identifier">expectations</span>
|
266
270
|
<span class="ruby-keyword kw">end</span></pre>
|
@@ -279,7 +283,7 @@ creates a new instance of this messaging strategy
|
|
279
283
|
|
280
284
|
|
281
285
|
<div id="deliver-method" class="method-detail ">
|
282
|
-
<a name="
|
286
|
+
<a name="M000056"></a>
|
283
287
|
|
284
288
|
<div class="method-heading">
|
285
289
|
|
@@ -300,9 +304,43 @@ deliver the message to the receiving isolation
|
|
300
304
|
<div class="method-source-code"
|
301
305
|
id="deliver-source">
|
302
306
|
<pre>
|
303
|
-
<span class="ruby-comment cmt"># File lib/caricature/
|
307
|
+
<span class="ruby-comment cmt"># File lib/caricature/messenger.rb, line 19</span>
|
304
308
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">deliver</span>(<span class="ruby-identifier">method_name</span>, <span class="ruby-identifier">return_type</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">args</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">b</span>)
|
305
|
-
<span class="ruby-identifier">
|
309
|
+
<span class="ruby-identifier">internal_deliver</span>(<span class="ruby-identifier">:instance</span>, <span class="ruby-identifier">method_name</span>, <span class="ruby-identifier">return_type</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">args</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">b</span>)
|
310
|
+
<span class="ruby-keyword kw">end</span></pre>
|
311
|
+
</div>
|
312
|
+
|
313
|
+
</div>
|
314
|
+
|
315
|
+
|
316
|
+
</div>
|
317
|
+
|
318
|
+
|
319
|
+
<div id="deliver-to-class-method" class="method-detail ">
|
320
|
+
<a name="M000058"></a>
|
321
|
+
|
322
|
+
<div class="method-heading">
|
323
|
+
|
324
|
+
<span class="method-name">deliver_to_class</span><span
|
325
|
+
class="method-args">(method_name, return_type, *args, &b)</span>
|
326
|
+
<span class="method-click-advice">click to toggle source</span>
|
327
|
+
|
328
|
+
</div>
|
329
|
+
|
330
|
+
<div class="method-description">
|
331
|
+
|
332
|
+
<p>
|
333
|
+
deliver the message to class of the receiving isolation
|
334
|
+
</p>
|
335
|
+
|
336
|
+
|
337
|
+
|
338
|
+
<div class="method-source-code"
|
339
|
+
id="deliver-to-class-source">
|
340
|
+
<pre>
|
341
|
+
<span class="ruby-comment cmt"># File lib/caricature/messenger.rb, line 24</span>
|
342
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">deliver_to_class</span>(<span class="ruby-identifier">method_name</span>, <span class="ruby-identifier">return_type</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">args</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">b</span>)
|
343
|
+
<span class="ruby-identifier">internal_deliver</span>(<span class="ruby-identifier">:class</span>, <span class="ruby-identifier">method_name</span>, <span class="ruby-identifier">return_type</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">args</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">b</span>)
|
306
344
|
<span class="ruby-keyword kw">end</span></pre>
|
307
345
|
</div>
|
308
346
|
|
@@ -314,6 +352,46 @@ deliver the message to the receiving isolation
|
|
314
352
|
|
315
353
|
</div>
|
316
354
|
|
355
|
+
<div id="protected-instance-method-details" class="method-section section">
|
356
|
+
<h3 class="section-header">Protected Instance Methods</h3>
|
357
|
+
|
358
|
+
|
359
|
+
<div id="internal-deliver-method" class="method-detail ">
|
360
|
+
<a name="M000059"></a>
|
361
|
+
|
362
|
+
<div class="method-heading">
|
363
|
+
|
364
|
+
<span class="method-name">internal_deliver</span><span
|
365
|
+
class="method-args">(mode, method_name, return_type, *args, &b)</span>
|
366
|
+
<span class="method-click-advice">click to toggle source</span>
|
367
|
+
|
368
|
+
</div>
|
369
|
+
|
370
|
+
<div class="method-description">
|
371
|
+
|
372
|
+
<p>
|
373
|
+
template method for looking up the expectation and/or returning a value
|
374
|
+
</p>
|
375
|
+
|
376
|
+
|
377
|
+
|
378
|
+
<div class="method-source-code"
|
379
|
+
id="internal-deliver-source">
|
380
|
+
<pre>
|
381
|
+
<span class="ruby-comment cmt"># File lib/caricature/messenger.rb, line 31</span>
|
382
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">internal_deliver</span>(<span class="ruby-identifier">mode</span>, <span class="ruby-identifier">method_name</span>, <span class="ruby-identifier">return_type</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">args</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">b</span>)
|
383
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-constant">NotImplementedError</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value str">"Override in an implementing class"</span>)
|
384
|
+
<span class="ruby-keyword kw">end</span></pre>
|
385
|
+
</div>
|
386
|
+
|
387
|
+
</div>
|
388
|
+
|
389
|
+
|
390
|
+
</div>
|
391
|
+
|
392
|
+
|
393
|
+
</div>
|
394
|
+
|
317
395
|
|
318
396
|
</div>
|
319
397
|
|