caricature 0.6.3 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (122) hide show
  1. data/README.rdoc +98 -0
  2. data/Rakefile +250 -47
  3. data/caricature.gemspec +79 -190
  4. data/lib/caricature/clr/descriptor.rb +14 -4
  5. data/lib/caricature/clr/isolation.rb +9 -0
  6. data/lib/caricature/clr/isolator.rb +4 -0
  7. data/lib/caricature/clr/messenger.rb +12 -17
  8. data/lib/caricature/clr.rb +1 -1
  9. data/lib/caricature/descriptor.rb +1 -1
  10. data/lib/caricature/expectation.rb +21 -11
  11. data/lib/caricature/isolation.rb +9 -3
  12. data/lib/caricature/isolator.rb +25 -9
  13. data/lib/caricature/messenger.rb +1 -1
  14. data/lib/caricature/verification.rb +2 -1
  15. data/lib/caricature/version.rb +6 -0
  16. data/lib/caricature.rb +8 -5
  17. data/spec/bacon_helper.rb +50 -30
  18. data/spec/bin/ClrModels.dll +0 -0
  19. data/spec/bin/ClrModels.dll.mdb +0 -0
  20. data/spec/integration/callback_spec.rb +157 -0
  21. data/spec/integration/ruby_to_ruby_spec.rb +12 -1
  22. data/spec/models/ClrModels.cs +8 -8
  23. data/spec/unit/expectation_spec.rb +35 -0
  24. metadata +35 -125
  25. data/.gitignore +0 -4
  26. data/README.markdown +0 -80
  27. data/VERSION +0 -1
  28. data/doc/Array.html +0 -251
  29. data/doc/Caricature/ArgumentRecording.html +0 -366
  30. data/doc/Caricature/ClrClassDescriptor.html +0 -303
  31. data/doc/Caricature/ClrClassMessenger.html +0 -263
  32. data/doc/Caricature/ClrInterfaceDescriptor.html +0 -295
  33. data/doc/Caricature/ClrInterfaceIsolator.html +0 -365
  34. data/doc/Caricature/ClrInterfaceMessenger.html +0 -260
  35. data/doc/Caricature/ClrIsolator.html +0 -425
  36. data/doc/Caricature/Expectation.html +0 -549
  37. data/doc/Caricature/ExpectationBuilder.html +0 -308
  38. data/doc/Caricature/ExpectationSyntax.html +0 -466
  39. data/doc/Caricature/Expectations.html +0 -347
  40. data/doc/Caricature/Interception/ClassMethods.html +0 -364
  41. data/doc/Caricature/Interception.html +0 -534
  42. data/doc/Caricature/Isolation.html +0 -763
  43. data/doc/Caricature/Isolator.html +0 -519
  44. data/doc/Caricature/MemberDescriptor.html +0 -335
  45. data/doc/Caricature/Messenger.html +0 -413
  46. data/doc/Caricature/MethodCallRecorder.html +0 -404
  47. data/doc/Caricature/MethodCallRecording.html +0 -493
  48. data/doc/Caricature/RubyIsolator.html +0 -416
  49. data/doc/Caricature/RubyMessenger.html +0 -261
  50. data/doc/Caricature/RubyObjectDescriptor.html +0 -289
  51. data/doc/Caricature/TypeDescriptor.html +0 -378
  52. data/doc/Caricature/Verification.html +0 -443
  53. data/doc/Caricature.html +0 -358
  54. data/doc/Class.html +0 -287
  55. data/doc/Hash.html +0 -255
  56. data/doc/Module.html +0 -287
  57. data/doc/Object.html +0 -409
  58. data/doc/README_markdown.html +0 -241
  59. data/doc/String.html +0 -369
  60. data/doc/System/String.html +0 -289
  61. data/doc/System/Type.html +0 -289
  62. data/doc/System.html +0 -207
  63. data/doc/created.rid +0 -1
  64. data/doc/images/brick.png +0 -0
  65. data/doc/images/brick_link.png +0 -0
  66. data/doc/images/bug.png +0 -0
  67. data/doc/images/bullet_black.png +0 -0
  68. data/doc/images/bullet_toggle_minus.png +0 -0
  69. data/doc/images/bullet_toggle_plus.png +0 -0
  70. data/doc/images/date.png +0 -0
  71. data/doc/images/find.png +0 -0
  72. data/doc/images/loadingAnimation.gif +0 -0
  73. data/doc/images/macFFBgHack.png +0 -0
  74. data/doc/images/package.png +0 -0
  75. data/doc/images/page_green.png +0 -0
  76. data/doc/images/page_white_text.png +0 -0
  77. data/doc/images/page_white_width.png +0 -0
  78. data/doc/images/plugin.png +0 -0
  79. data/doc/images/ruby.png +0 -0
  80. data/doc/images/tag_green.png +0 -0
  81. data/doc/images/wrench.png +0 -0
  82. data/doc/images/wrench_orange.png +0 -0
  83. data/doc/images/zoom.png +0 -0
  84. data/doc/index.html +0 -342
  85. data/doc/js/darkfish.js +0 -116
  86. data/doc/js/jquery.js +0 -32
  87. data/doc/js/quicksearch.js +0 -114
  88. data/doc/js/thickbox-compressed.js +0 -10
  89. data/doc/lib/caricature/clr/aspnet_mvc_rb.html +0 -52
  90. data/doc/lib/caricature/clr/descriptor_rb.html +0 -52
  91. data/doc/lib/caricature/clr/isolation_rb.html +0 -52
  92. data/doc/lib/caricature/clr/isolator_rb.html +0 -52
  93. data/doc/lib/caricature/clr/messenger_rb.html +0 -52
  94. data/doc/lib/caricature/clr_rb.html +0 -52
  95. data/doc/lib/caricature/descriptor_rb.html +0 -52
  96. data/doc/lib/caricature/expectation_rb.html +0 -52
  97. data/doc/lib/caricature/isolation_rb.html +0 -52
  98. data/doc/lib/caricature/isolator_rb.html +0 -52
  99. data/doc/lib/caricature/messaging_rb.html +0 -52
  100. data/doc/lib/caricature/messenger_rb.html +0 -52
  101. data/doc/lib/caricature/method_call_recorder_rb.html +0 -52
  102. data/doc/lib/caricature/verification_rb.html +0 -52
  103. data/doc/lib/caricature_rb.html +0 -52
  104. data/doc/lib/core_ext/array_rb.html +0 -52
  105. data/doc/lib/core_ext/class_rb.html +0 -52
  106. data/doc/lib/core_ext/core_ext_rb.html +0 -52
  107. data/doc/lib/core_ext/hash_rb.html +0 -52
  108. data/doc/lib/core_ext/module_rb.html +0 -52
  109. data/doc/lib/core_ext/object_rb.html +0 -52
  110. data/doc/lib/core_ext/string_rb.html +0 -52
  111. data/doc/lib/core_ext/system/string_rb.html +0 -52
  112. data/doc/lib/core_ext/system/type_rb.html +0 -52
  113. data/doc/rdoc.css +0 -696
  114. data/irb_init.rb +0 -9
  115. data/lib/bin/Workarounds.dll +0 -0
  116. data/lib/bin/Workarounds.pdb +0 -0
  117. data/pkg/.gitignore +0 -0
  118. data/pkg/caricature-0.1.0.gem +0 -0
  119. data/pkg/caricature-0.5.0.gem +0 -0
  120. data/pkg/caricature-0.6.0.gem +0 -0
  121. data/spec/bin/.gitignore +0 -0
  122. data/workarounds/ReflectionHelper.cs +0 -30
@@ -1,534 +0,0 @@
1
- <?xml version="1.0" encoding="utf-8"?>
2
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
3
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
4
- <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
5
- <head>
6
- <meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
7
-
8
- <title>Module: Caricature::Interception</title>
9
-
10
- <link rel="stylesheet" href="../rdoc.css" type="text/css" media="screen" />
11
-
12
- <script src="../js/jquery.js" type="text/javascript"
13
- charset="utf-8"></script>
14
- <script src="../js/thickbox-compressed.js" type="text/javascript"
15
- charset="utf-8"></script>
16
- <script src="../js/quicksearch.js" type="text/javascript"
17
- charset="utf-8"></script>
18
- <script src="../js/darkfish.js" type="text/javascript"
19
- charset="utf-8"></script>
20
-
21
- </head>
22
- <body class="module">
23
-
24
- <div id="metadata">
25
- <div id="file-metadata">
26
- <div id="file-list-section" class="section">
27
- <h3 class="section-header">In Files</h3>
28
- <div class="section-body">
29
- <ul>
30
-
31
- <li><a href="../lib/caricature/isolator_rb.html?TB_iframe=true&amp;height=550&amp;width=785"
32
- class="thickbox" title="lib/caricature/isolator.rb">lib/caricature/isolator.rb</a></li>
33
-
34
- </ul>
35
- </div>
36
- </div>
37
-
38
-
39
- </div>
40
-
41
- <div id="class-metadata">
42
-
43
- <!-- Parent Class -->
44
-
45
-
46
- <!-- Namespace Contents -->
47
-
48
- <div id="namespace-list-section" class="section">
49
- <h3 class="section-header">Namespace</h3>
50
- <ul class="link-list">
51
-
52
- <li><span class="type">MODULE</span> <a href="Interception/ClassMethods.html">Caricature::Interception::ClassMethods</a></li>
53
-
54
- </ul>
55
- </div>
56
-
57
-
58
- <!-- Method Quickref -->
59
-
60
- <div id="method-list-section" class="section">
61
- <h3 class="section-header">Methods</h3>
62
- <ul class="link-list">
63
-
64
- <li><a href="#M000059">::included</a></li>
65
-
66
- <li><a href="#M000069">#did_class_receive?</a></li>
67
-
68
- <li><a href="#M000066">#did_receive?</a></li>
69
-
70
- <li><a href="#M000061">#isolation_context</a></li>
71
-
72
- <li><a href="#M000065">#when_class_receives</a></li>
73
-
74
- <li><a href="#M000063">#when_receiving</a></li>
75
-
76
- </ul>
77
- </div>
78
-
79
-
80
- <!-- Included Modules -->
81
-
82
- </div>
83
-
84
- <div id="project-metadata">
85
-
86
-
87
- <div id="fileindex-section" class="section project-section">
88
- <h3 class="section-header">Files</h3>
89
- <ul>
90
-
91
- <li class="file"><a href="../README_markdown.html">README.markdown</a></li>
92
-
93
- </ul>
94
- </div>
95
-
96
-
97
- <div id="classindex-section" class="section project-section">
98
- <h3 class="section-header">Class Index
99
- <span class="search-toggle"><img src="../images/find.png"
100
- height="16" width="16" alt="[+]"
101
- title="show/hide quicksearch" /></span></h3>
102
- <form action="#" method="get" accept-charset="utf-8" class="initially-hidden">
103
- <fieldset>
104
- <legend>Quicksearch</legend>
105
- <input type="text" name="quicksearch" value=""
106
- class="quicksearch-field" />
107
- </fieldset>
108
- </form>
109
-
110
- <ul class="link-list">
111
-
112
- <li><a href="../Caricature.html">Caricature</a></li>
113
-
114
- <li><a href="../Caricature/ArgumentRecording.html">Caricature::ArgumentRecording</a></li>
115
-
116
- <li><a href="../Caricature/ClrClassDescriptor.html">Caricature::ClrClassDescriptor</a></li>
117
-
118
- <li><a href="../Caricature/ClrClassMessenger.html">Caricature::ClrClassMessenger</a></li>
119
-
120
- <li><a href="../Caricature/ClrInterfaceDescriptor.html">Caricature::ClrInterfaceDescriptor</a></li>
121
-
122
- <li><a href="../Caricature/ClrInterfaceIsolator.html">Caricature::ClrInterfaceIsolator</a></li>
123
-
124
- <li><a href="../Caricature/ClrInterfaceMessenger.html">Caricature::ClrInterfaceMessenger</a></li>
125
-
126
- <li><a href="../Caricature/ClrIsolator.html">Caricature::ClrIsolator</a></li>
127
-
128
- <li><a href="../Caricature/Expectation.html">Caricature::Expectation</a></li>
129
-
130
- <li><a href="../Caricature/ExpectationBuilder.html">Caricature::ExpectationBuilder</a></li>
131
-
132
- <li><a href="../Caricature/ExpectationSyntax.html">Caricature::ExpectationSyntax</a></li>
133
-
134
- <li><a href="../Caricature/Expectations.html">Caricature::Expectations</a></li>
135
-
136
- <li><a href="../Caricature/Interception.html">Caricature::Interception</a></li>
137
-
138
- <li><a href="../Caricature/Interception/ClassMethods.html">Caricature::Interception::ClassMethods</a></li>
139
-
140
- <li><a href="../Caricature/Isolation.html">Caricature::Isolation</a></li>
141
-
142
- <li><a href="../Caricature/Isolator.html">Caricature::Isolator</a></li>
143
-
144
- <li><a href="../Caricature/MemberDescriptor.html">Caricature::MemberDescriptor</a></li>
145
-
146
- <li><a href="../Caricature/Messenger.html">Caricature::Messenger</a></li>
147
-
148
- <li><a href="../Caricature/MethodCallRecorder.html">Caricature::MethodCallRecorder</a></li>
149
-
150
- <li><a href="../Caricature/MethodCallRecording.html">Caricature::MethodCallRecording</a></li>
151
-
152
- <li><a href="../Caricature/RubyIsolator.html">Caricature::RubyIsolator</a></li>
153
-
154
- <li><a href="../Caricature/RubyMessenger.html">Caricature::RubyMessenger</a></li>
155
-
156
- <li><a href="../Caricature/RubyObjectDescriptor.html">Caricature::RubyObjectDescriptor</a></li>
157
-
158
- <li><a href="../Caricature/TypeDescriptor.html">Caricature::TypeDescriptor</a></li>
159
-
160
- <li><a href="../Caricature/Verification.html">Caricature::Verification</a></li>
161
-
162
- <li><a href="../System.html">System</a></li>
163
-
164
- <li><a href="../System/String.html">System::String</a></li>
165
-
166
- <li><a href="../System/Type.html">System::Type</a></li>
167
-
168
- <li><a href="../Array.html">Array</a></li>
169
-
170
- <li><a href="../Class.html">Class</a></li>
171
-
172
- <li><a href="../Hash.html">Hash</a></li>
173
-
174
- <li><a href="../Module.html">Module</a></li>
175
-
176
- <li><a href="../Object.html">Object</a></li>
177
-
178
- <li><a href="../String.html">String</a></li>
179
-
180
- </ul>
181
- <div id="no-class-search-results" style="display: none;">No matching classes.</div>
182
- </div>
183
-
184
-
185
- </div>
186
- </div>
187
-
188
- <div id="documentation">
189
- <h1 class="module">Caricature::Interception</h1>
190
-
191
- <div id="description">
192
- <p>
193
- Groups the methods for interception together this is a mix-in for the
194
- created isolations for classes
195
- </p>
196
-
197
- </div>
198
-
199
- <!-- Constants -->
200
-
201
-
202
- <!-- Attributes -->
203
-
204
-
205
- <!-- Methods -->
206
-
207
- <div id="public-class-method-details" class="method-section section">
208
- <h3 class="section-header">Public Class Methods</h3>
209
-
210
-
211
- <div id="included-method" class="method-detail ">
212
- <a name="M000059"></a>
213
-
214
- <div class="method-heading">
215
-
216
- <span class="method-name">included</span><span
217
- class="method-args">(base)</span>
218
- <span class="method-click-advice">click to toggle source</span>
219
-
220
- </div>
221
-
222
- <div class="method-description">
223
-
224
- <p>
225
- mixes in the class methods of this module when it gets included in a class.
226
- </p>
227
-
228
-
229
-
230
- <div class="method-source-code"
231
- id="included-source">
232
- <pre>
233
- <span class="ruby-comment cmt"># File lib/caricature/isolator.rb, line 63</span>
234
- <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">included</span>(<span class="ruby-identifier">base</span>)
235
- <span class="ruby-identifier">base</span>.<span class="ruby-identifier">extend</span> <span class="ruby-constant">ClassMethods</span>
236
- <span class="ruby-keyword kw">end</span></pre>
237
- </div>
238
-
239
- </div>
240
-
241
-
242
- </div>
243
-
244
-
245
- </div>
246
-
247
- <div id="public-instance-method-details" class="method-section section">
248
- <h3 class="section-header">Public Instance Methods</h3>
249
-
250
-
251
- <div id="did-class-receive--method" class="method-detail ">
252
- <a name="M000069"></a>
253
-
254
- <div class="method-heading">
255
-
256
- <span class="method-name">did_class_receive?</span><span
257
- class="method-args">(method_name, &block)</span>
258
- <span class="method-click-advice">click to toggle source</span>
259
-
260
- </div>
261
-
262
- <div class="method-description">
263
-
264
- <p>
265
- Verifies whether the specified class method has been called You can specify
266
- constraints in the block
267
- </p>
268
- <p>
269
- The most complex configuration you can make currently is one that is
270
- constrained by arguments. This is most likely to be extended in the future
271
- to allow for more complex verifications.
272
- </p>
273
- <p>
274
- Example:
275
- </p>
276
- <pre>
277
- an_isolation.did_class_receive?(:a_method) do |method_call|
278
- method_call.with(3, &quot;a&quot;)
279
- end.should.be.successful
280
- </pre>
281
- <p>
282
- is equivalent to:
283
- </p>
284
- <pre>
285
- an_isolation.did_class_receive?(:a_method).with(3, &quot;a&quot;).should.be.successful
286
- </pre>
287
- <p>
288
- You will probably be using this method only when you&#8217;re interested in
289
- whether a method has been called during the course of the test you&#8217;re
290
- running.
291
- </p>
292
-
293
-
294
-
295
- <div class="method-source-code"
296
- id="did-class-receive--source">
297
- <pre>
298
- <span class="ruby-comment cmt"># File lib/caricature/isolator.rb, line 151</span>
299
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">did_class_receive?</span>(<span class="ruby-identifier">method_name</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
300
- <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">did_receive?</span>(<span class="ruby-identifier">method_name</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
301
- <span class="ruby-keyword kw">end</span></pre>
302
- </div>
303
-
304
- </div>
305
-
306
-
307
- </div>
308
-
309
-
310
- <div id="did-receive--method" class="method-detail ">
311
- <a name="M000066"></a>
312
-
313
- <div class="method-heading">
314
-
315
- <span class="method-name">did_receive?</span><span
316
- class="method-args">(method_name, &block)</span>
317
- <span class="method-click-advice">click to toggle source</span>
318
-
319
- </div>
320
-
321
- <div class="method-description">
322
-
323
- <p>
324
- Verifies whether the specified method has been called You can specify
325
- constraints in the block
326
- </p>
327
- <p>
328
- The most complex configuration you can make currently is one that is
329
- constrained by arguments. This is most likely to be extended in the future
330
- to allow for more complex verifications.
331
- </p>
332
- <p>
333
- Example:
334
- </p>
335
- <pre>
336
- an_isolation.did_receive?(:a_method) do |method_call|
337
- method_call.with(3, &quot;a&quot;)
338
- end.should.be.successful
339
- </pre>
340
- <p>
341
- is equivalent to:
342
- </p>
343
- <pre>
344
- an_isolation.did_receive?(:a_method).with(3, &quot;a&quot;).should.be.successful
345
- </pre>
346
- <p>
347
- You will probably be using this method only when you&#8217;re interested in
348
- whether a method has been called during the course of the test you&#8217;re
349
- running.
350
- </p>
351
-
352
-
353
-
354
- <div class="method-source-code"
355
- id="did-receive--source">
356
- <pre>
357
- <span class="ruby-comment cmt"># File lib/caricature/isolator.rb, line 129</span>
358
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">did_receive?</span>(<span class="ruby-identifier">method_name</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
359
- <span class="ruby-identifier">isolation_context</span>.<span class="ruby-identifier">verify</span> <span class="ruby-identifier">method_name</span>
360
- <span class="ruby-keyword kw">end</span></pre>
361
- </div>
362
-
363
- </div>
364
-
365
-
366
- </div>
367
-
368
-
369
- <div id="isolation-context-method" class="method-detail ">
370
- <a name="M000061"></a>
371
-
372
- <div class="method-heading">
373
-
374
- <span class="method-name">isolation_context</span><span
375
- class="method-args">()</span>
376
- <span class="method-click-advice">click to toggle source</span>
377
-
378
- </div>
379
-
380
- <div class="method-description">
381
-
382
- <p>
383
- the context of this isolation instance. this context takes care of
384
- responding to method calls etc.
385
- </p>
386
-
387
-
388
-
389
- <div class="method-source-code"
390
- id="isolation-context-source">
391
- <pre>
392
- <span class="ruby-comment cmt"># File lib/caricature/isolator.rb, line 69</span>
393
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">isolation_context</span>
394
- <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">isolation_context</span>
395
- <span class="ruby-keyword kw">end</span></pre>
396
- </div>
397
-
398
- </div>
399
-
400
-
401
- </div>
402
-
403
-
404
- <div id="when-class-receives-method" class="method-detail ">
405
- <a name="M000065"></a>
406
-
407
- <div class="method-heading">
408
-
409
- <span class="method-name">when_class_receives</span><span
410
- class="method-args">(method_name, &block)</span>
411
- <span class="method-click-advice">click to toggle source</span>
412
-
413
- </div>
414
-
415
- <div class="method-description">
416
-
417
- <p>
418
- Replaces the call to the class of the proxy with the one you create with
419
- this method. You can specify more specific criteria in the block to
420
- configure the expectation.
421
- </p>
422
- <p>
423
- Example:
424
- </p>
425
- <pre>
426
- an_isolation.when_class_receives(:a_method) do |method_call|
427
- method_call.with(3, &quot;a&quot;).return(5)
428
- end
429
- </pre>
430
- <p>
431
- is equivalent to:
432
- </p>
433
- <pre>
434
- an_isolation.when_class_receives(:a_method).with(3, &quot;a&quot;).return(5)
435
- </pre>
436
- <p>
437
- You will most likely use this method when you want your stubs to return
438
- something else than <tt>nil</tt> when they get called during the run of the
439
- test they are defined in.
440
- </p>
441
-
442
-
443
-
444
- <div class="method-source-code"
445
- id="when-class-receives-source">
446
- <pre>
447
- <span class="ruby-comment cmt"># File lib/caricature/isolator.rb, line 107</span>
448
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">when_class_receives</span>(<span class="ruby-identifier">method_name</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
449
- <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">when_receiving</span> <span class="ruby-identifier">method_name</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>
450
- <span class="ruby-keyword kw">end</span></pre>
451
- </div>
452
-
453
- </div>
454
-
455
-
456
- </div>
457
-
458
-
459
- <div id="when-receiving-method" class="method-detail ">
460
- <a name="M000063"></a>
461
-
462
- <div class="method-heading">
463
-
464
- <span class="method-name">when_receiving</span><span
465
- class="method-args">(method_name, &block)</span>
466
- <span class="method-click-advice">click to toggle source</span>
467
-
468
- </div>
469
-
470
- <div class="method-description">
471
-
472
- <p>
473
- Replaces the call to the proxy with the one you create with this method.
474
- You can specify more specific criteria in the block to configure the
475
- expectation.
476
- </p>
477
- <p>
478
- Example:
479
- </p>
480
- <pre>
481
- an_isolation.when_receiving(:a_method) do |method_call|
482
- method_call.with(3, &quot;a&quot;).return(5)
483
- end
484
- </pre>
485
- <p>
486
- is equivalent to:
487
- </p>
488
- <pre>
489
- an_isolation.when_receiving(:a_method).with(3, &quot;a&quot;).return(5)
490
- </pre>
491
- <p>
492
- You will most likely use this method when you want your stubs to return
493
- something else than <tt>nil</tt> when they get called during the run of the
494
- test they are defined in.
495
- </p>
496
-
497
-
498
-
499
- <div class="method-source-code"
500
- id="when-receiving-source">
501
- <pre>
502
- <span class="ruby-comment cmt"># File lib/caricature/isolator.rb, line 88</span>
503
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">when_receiving</span>(<span class="ruby-identifier">method_name</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
504
- <span class="ruby-identifier">isolation_context</span>.<span class="ruby-identifier">create_override</span> <span class="ruby-identifier">method_name</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>
505
- <span class="ruby-keyword kw">end</span></pre>
506
- </div>
507
-
508
- </div>
509
-
510
-
511
- </div>
512
-
513
-
514
- </div>
515
-
516
-
517
- </div>
518
-
519
-
520
- <div id="rdoc-debugging-section-dump" class="debugging-section">
521
-
522
- <p>Disabled; run with --debug to generate this.</p>
523
-
524
- </div>
525
-
526
- <div id="validator-badges">
527
- <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
528
- <p><small>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish
529
- Rdoc Generator</a> 1.1.6</small>.</p>
530
- </div>
531
-
532
- </body>
533
- </html>
534
-