caricature 0.5.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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
@@ -52,7 +52,11 @@
|
|
52
52
|
<h3 class="section-header">Methods</h3>
|
53
53
|
<ul class="link-list">
|
54
54
|
|
55
|
-
<li><a href="#
|
55
|
+
<li><a href="#M000050">#did_receive?</a></li>
|
56
|
+
|
57
|
+
<li><a href="#M000046">#isolation_context</a></li>
|
58
|
+
|
59
|
+
<li><a href="#M000048">#when_receiving</a></li>
|
56
60
|
|
57
61
|
</ul>
|
58
62
|
</div>
|
@@ -188,8 +192,67 @@ the class methods of this intercepting object
|
|
188
192
|
<h3 class="section-header">Public Instance Methods</h3>
|
189
193
|
|
190
194
|
|
195
|
+
<div id="did-receive--method" class="method-detail ">
|
196
|
+
<a name="M000050"></a>
|
197
|
+
|
198
|
+
<div class="method-heading">
|
199
|
+
|
200
|
+
<span class="method-name">did_receive?</span><span
|
201
|
+
class="method-args">(method_name, &block)</span>
|
202
|
+
<span class="method-click-advice">click to toggle source</span>
|
203
|
+
|
204
|
+
</div>
|
205
|
+
|
206
|
+
<div class="method-description">
|
207
|
+
|
208
|
+
<p>
|
209
|
+
Verifies whether the specified method has been called You can specify
|
210
|
+
constraints in the block
|
211
|
+
</p>
|
212
|
+
<p>
|
213
|
+
The most complex configuration you can make currently is one that is
|
214
|
+
constrained by arguments. This is most likely to be extended in the future
|
215
|
+
to allow for more complex verifications.
|
216
|
+
</p>
|
217
|
+
<p>
|
218
|
+
Example:
|
219
|
+
</p>
|
220
|
+
<pre>
|
221
|
+
an_isolation.class.did_receive?(:a_method) do |method_call|
|
222
|
+
method_call.with(3, "a")
|
223
|
+
end.should.be.successful
|
224
|
+
</pre>
|
225
|
+
<p>
|
226
|
+
is equivalent to:
|
227
|
+
</p>
|
228
|
+
<pre>
|
229
|
+
an_isolation.class.did_receive?(:a_method).with(3, "a").should.be.successful
|
230
|
+
</pre>
|
231
|
+
<p>
|
232
|
+
You will probably be using this method only when you’re interested in
|
233
|
+
whether a method has been called during the course of the test you’re
|
234
|
+
running.
|
235
|
+
</p>
|
236
|
+
|
237
|
+
|
238
|
+
|
239
|
+
<div class="method-source-code"
|
240
|
+
id="did-receive--source">
|
241
|
+
<pre>
|
242
|
+
<span class="ruby-comment cmt"># File lib/caricature/isolator.rb, line 56</span>
|
243
|
+
<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">&</span><span class="ruby-identifier">block</span>)
|
244
|
+
<span class="ruby-identifier">isolation_context</span>.<span class="ruby-identifier">class_verify</span> <span class="ruby-identifier">method_name</span>
|
245
|
+
<span class="ruby-keyword kw">end</span></pre>
|
246
|
+
</div>
|
247
|
+
|
248
|
+
</div>
|
249
|
+
|
250
|
+
|
251
|
+
</div>
|
252
|
+
|
253
|
+
|
191
254
|
<div id="isolation-context-method" class="method-detail ">
|
192
|
-
<a name="
|
255
|
+
<a name="M000046"></a>
|
193
256
|
|
194
257
|
<div class="method-heading">
|
195
258
|
|
@@ -223,6 +286,61 @@ responding to method calls etc.
|
|
223
286
|
</div>
|
224
287
|
|
225
288
|
|
289
|
+
<div id="when-receiving-method" class="method-detail ">
|
290
|
+
<a name="M000048"></a>
|
291
|
+
|
292
|
+
<div class="method-heading">
|
293
|
+
|
294
|
+
<span class="method-name">when_receiving</span><span
|
295
|
+
class="method-args">(method_name, &block)</span>
|
296
|
+
<span class="method-click-advice">click to toggle source</span>
|
297
|
+
|
298
|
+
</div>
|
299
|
+
|
300
|
+
<div class="method-description">
|
301
|
+
|
302
|
+
<p>
|
303
|
+
Replaces the call to the proxy with the one you create with this method.
|
304
|
+
You can specify more specific criteria in the block to configure the
|
305
|
+
expectation.
|
306
|
+
</p>
|
307
|
+
<p>
|
308
|
+
Example:
|
309
|
+
</p>
|
310
|
+
<pre>
|
311
|
+
an_isolation.class.when_receiving(:a_method) do |method_call|
|
312
|
+
method_call.with(3, "a").return(5)
|
313
|
+
end
|
314
|
+
</pre>
|
315
|
+
<p>
|
316
|
+
is equivalent to:
|
317
|
+
</p>
|
318
|
+
<pre>
|
319
|
+
an_isolation.class.when_receiving(:a_method).with(3, "a").return(5)
|
320
|
+
</pre>
|
321
|
+
<p>
|
322
|
+
You will most likely use this method when you want your stubs to return
|
323
|
+
something else than <tt>nil</tt> when they get called during the run of the
|
324
|
+
test they are defined in.
|
325
|
+
</p>
|
326
|
+
|
327
|
+
|
328
|
+
|
329
|
+
<div class="method-source-code"
|
330
|
+
id="when-receiving-source">
|
331
|
+
<pre>
|
332
|
+
<span class="ruby-comment cmt"># File lib/caricature/isolator.rb, line 34</span>
|
333
|
+
<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">&</span><span class="ruby-identifier">block</span>)
|
334
|
+
<span class="ruby-identifier">isolation_context</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>
|
335
|
+
<span class="ruby-keyword kw">end</span></pre>
|
336
|
+
</div>
|
337
|
+
|
338
|
+
</div>
|
339
|
+
|
340
|
+
|
341
|
+
</div>
|
342
|
+
|
343
|
+
|
226
344
|
</div>
|
227
345
|
|
228
346
|
|
@@ -61,13 +61,17 @@
|
|
61
61
|
<h3 class="section-header">Methods</h3>
|
62
62
|
<ul class="link-list">
|
63
63
|
|
64
|
-
<li><a href="#
|
64
|
+
<li><a href="#M000052">::included</a></li>
|
65
65
|
|
66
|
-
<li><a href="#
|
66
|
+
<li><a href="#M000062">#did_class_receive?</a></li>
|
67
67
|
|
68
|
-
<li><a href="#
|
68
|
+
<li><a href="#M000060">#did_receive?</a></li>
|
69
69
|
|
70
|
-
<li><a href="#
|
70
|
+
<li><a href="#M000053">#isolation_context</a></li>
|
71
|
+
|
72
|
+
<li><a href="#M000057">#when_class_receives</a></li>
|
73
|
+
|
74
|
+
<li><a href="#M000054">#when_receiving</a></li>
|
71
75
|
|
72
76
|
</ul>
|
73
77
|
</div>
|
@@ -205,7 +209,7 @@ created isolations for classes
|
|
205
209
|
|
206
210
|
|
207
211
|
<div id="included-method" class="method-detail ">
|
208
|
-
<a name="
|
212
|
+
<a name="M000052"></a>
|
209
213
|
|
210
214
|
<div class="method-heading">
|
211
215
|
|
@@ -226,7 +230,7 @@ mixes in the class methods of this module when it gets included in a class.
|
|
226
230
|
<div class="method-source-code"
|
227
231
|
id="included-source">
|
228
232
|
<pre>
|
229
|
-
<span class="ruby-comment cmt"># File lib/caricature/isolator.rb, line
|
233
|
+
<span class="ruby-comment cmt"># File lib/caricature/isolator.rb, line 63</span>
|
230
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>)
|
231
235
|
<span class="ruby-identifier">base</span>.<span class="ruby-identifier">extend</span> <span class="ruby-constant">ClassMethods</span>
|
232
236
|
<span class="ruby-keyword kw">end</span></pre>
|
@@ -244,8 +248,67 @@ mixes in the class methods of this module when it gets included in a class.
|
|
244
248
|
<h3 class="section-header">Public Instance Methods</h3>
|
245
249
|
|
246
250
|
|
251
|
+
<div id="did-class-receive--method" class="method-detail ">
|
252
|
+
<a name="M000062"></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, "a")
|
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, "a").should.be.successful
|
286
|
+
</pre>
|
287
|
+
<p>
|
288
|
+
You will probably be using this method only when you’re interested in
|
289
|
+
whether a method has been called during the course of the test you’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">&</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">&</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
|
+
|
247
310
|
<div id="did-receive--method" class="method-detail ">
|
248
|
-
<a name="
|
311
|
+
<a name="M000060"></a>
|
249
312
|
|
250
313
|
<div class="method-heading">
|
251
314
|
|
@@ -291,7 +354,7 @@ running.
|
|
291
354
|
<div class="method-source-code"
|
292
355
|
id="did-receive--source">
|
293
356
|
<pre>
|
294
|
-
<span class="ruby-comment cmt"># File lib/caricature/isolator.rb, line
|
357
|
+
<span class="ruby-comment cmt"># File lib/caricature/isolator.rb, line 129</span>
|
295
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">&</span><span class="ruby-identifier">block</span>)
|
296
359
|
<span class="ruby-identifier">isolation_context</span>.<span class="ruby-identifier">verify</span> <span class="ruby-identifier">method_name</span>
|
297
360
|
<span class="ruby-keyword kw">end</span></pre>
|
@@ -304,7 +367,7 @@ running.
|
|
304
367
|
|
305
368
|
|
306
369
|
<div id="isolation-context-method" class="method-detail ">
|
307
|
-
<a name="
|
370
|
+
<a name="M000053"></a>
|
308
371
|
|
309
372
|
<div class="method-heading">
|
310
373
|
|
@@ -326,7 +389,7 @@ responding to method calls etc.
|
|
326
389
|
<div class="method-source-code"
|
327
390
|
id="isolation-context-source">
|
328
391
|
<pre>
|
329
|
-
<span class="ruby-comment cmt"># File lib/caricature/isolator.rb, line
|
392
|
+
<span class="ruby-comment cmt"># File lib/caricature/isolator.rb, line 69</span>
|
330
393
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">isolation_context</span>
|
331
394
|
<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">isolation_context</span>
|
332
395
|
<span class="ruby-keyword kw">end</span></pre>
|
@@ -338,8 +401,63 @@ responding to method calls etc.
|
|
338
401
|
</div>
|
339
402
|
|
340
403
|
|
404
|
+
<div id="when-class-receives-method" class="method-detail ">
|
405
|
+
<a name="M000057"></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, "a").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, "a").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">&</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">&</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
|
+
|
341
459
|
<div id="when-receiving-method" class="method-detail ">
|
342
|
-
<a name="
|
460
|
+
<a name="M000054"></a>
|
343
461
|
|
344
462
|
<div class="method-heading">
|
345
463
|
|
@@ -381,7 +499,7 @@ test they are defined in.
|
|
381
499
|
<div class="method-source-code"
|
382
500
|
id="when-receiving-source">
|
383
501
|
<pre>
|
384
|
-
<span class="ruby-comment cmt"># File lib/caricature/isolator.rb, line
|
502
|
+
<span class="ruby-comment cmt"># File lib/caricature/isolator.rb, line 88</span>
|
385
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">&</span><span class="ruby-identifier">block</span>)
|
386
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">&</span><span class="ruby-identifier">block</span>
|
387
505
|
<span class="ruby-keyword kw">end</span></pre>
|