mocha 0.11.3 → 0.11.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (61) hide show
  1. data/README.rdoc +3 -3
  2. data/RELEASE.rdoc +3 -0
  3. data/Rakefile +1 -3
  4. data/lib/mocha/version.rb +1 -1
  5. data/mocha.gemspec +1 -1
  6. metadata +12 -67
  7. data/doc/.nojekyll +0 -0
  8. data/doc/Mocha.html +0 -112
  9. data/doc/Mocha/API.html +0 -898
  10. data/doc/Mocha/ClassMethods.html +0 -246
  11. data/doc/Mocha/Configuration.html +0 -471
  12. data/doc/Mocha/Expectation.html +0 -2570
  13. data/doc/Mocha/Mock.html +0 -830
  14. data/doc/Mocha/ObjectMethods.html +0 -668
  15. data/doc/Mocha/ParameterMatchers.html +0 -2715
  16. data/doc/Mocha/ParameterMatchers/AllOf.html +0 -137
  17. data/doc/Mocha/ParameterMatchers/AnyOf.html +0 -137
  18. data/doc/Mocha/ParameterMatchers/AnyParameters.html +0 -136
  19. data/doc/Mocha/ParameterMatchers/Anything.html +0 -136
  20. data/doc/Mocha/ParameterMatchers/Base.html +0 -419
  21. data/doc/Mocha/ParameterMatchers/Equals.html +0 -137
  22. data/doc/Mocha/ParameterMatchers/HasEntries.html +0 -137
  23. data/doc/Mocha/ParameterMatchers/HasEntry.html +0 -137
  24. data/doc/Mocha/ParameterMatchers/HasKey.html +0 -137
  25. data/doc/Mocha/ParameterMatchers/HasValue.html +0 -137
  26. data/doc/Mocha/ParameterMatchers/Includes.html +0 -137
  27. data/doc/Mocha/ParameterMatchers/InstanceOf.html +0 -137
  28. data/doc/Mocha/ParameterMatchers/IsA.html +0 -136
  29. data/doc/Mocha/ParameterMatchers/KindOf.html +0 -137
  30. data/doc/Mocha/ParameterMatchers/Not.html +0 -137
  31. data/doc/Mocha/ParameterMatchers/Optionally.html +0 -136
  32. data/doc/Mocha/ParameterMatchers/QueryStringMatches.html +0 -136
  33. data/doc/Mocha/ParameterMatchers/RegexpMatches.html +0 -137
  34. data/doc/Mocha/ParameterMatchers/RespondsWith.html +0 -137
  35. data/doc/Mocha/ParameterMatchers/YamlEquivalent.html +0 -137
  36. data/doc/Mocha/Sequence.html +0 -133
  37. data/doc/Mocha/StateMachine.html +0 -510
  38. data/doc/Mocha/StateMachine/State.html +0 -125
  39. data/doc/Mocha/StateMachine/StatePredicate.html +0 -125
  40. data/doc/Mocha/StubbingError.html +0 -134
  41. data/doc/Mocha/UnexpectedInvocation.html +0 -124
  42. data/doc/_index.html +0 -481
  43. data/doc/class_list.html +0 -47
  44. data/doc/css/common.css +0 -1
  45. data/doc/css/full_list.css +0 -55
  46. data/doc/css/style.css +0 -322
  47. data/doc/file.COPYING.html +0 -72
  48. data/doc/file.MIT-LICENSE.html +0 -86
  49. data/doc/file.README.html +0 -153
  50. data/doc/file.RELEASE.html +0 -954
  51. data/doc/file.misc.html +0 -108
  52. data/doc/file.mocha.html +0 -90
  53. data/doc/file.stubba.html +0 -129
  54. data/doc/file_list.html +0 -67
  55. data/doc/frames.html +0 -13
  56. data/doc/index.html +0 -153
  57. data/doc/js/app.js +0 -205
  58. data/doc/js/full_list.js +0 -173
  59. data/doc/js/jquery.js +0 -16
  60. data/doc/method_list.html +0 -510
  61. data/doc/top-level-namespace.html +0 -105
@@ -1,2715 +0,0 @@
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 http-equiv="Content-Type" content="text/html; charset=utf-8" />
6
- <title>
7
- Module: Mocha::ParameterMatchers
8
-
9
- &mdash; Mocha 0.11.3
10
-
11
- </title>
12
-
13
- <link rel="stylesheet" href="../css/style.css" type="text/css" media="screen" charset="utf-8" />
14
-
15
- <link rel="stylesheet" href="../css/common.css" type="text/css" media="screen" charset="utf-8" />
16
-
17
- <script type="text/javascript" charset="utf-8">
18
- relpath = '..';
19
- if (relpath != '') relpath += '/';
20
- </script>
21
-
22
- <script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
23
-
24
- <script type="text/javascript" charset="utf-8" src="../js/app.js"></script>
25
-
26
-
27
- </head>
28
- <body>
29
- <script type="text/javascript" charset="utf-8">
30
- if (window.top.frames.main) document.body.className = 'frames';
31
- </script>
32
-
33
- <div id="header">
34
- <div id="menu">
35
-
36
- <a href="../_index.html">Index (P)</a> &raquo;
37
- <span class='title'><span class='object_link'><a href="../Mocha.html" title="Mocha (module)">Mocha</a></span></span>
38
- &raquo;
39
- <span class="title">ParameterMatchers</span>
40
-
41
-
42
- <div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
43
- </div>
44
-
45
- <div id="search">
46
-
47
- <a id="class_list_link" href="#">Class List</a>
48
-
49
- <a id="method_list_link" href="#">Method List</a>
50
-
51
- <a id="file_list_link" href="#">File List</a>
52
-
53
- </div>
54
- <div class="clear"></div>
55
- </div>
56
-
57
- <iframe id="search_frame"></iframe>
58
-
59
- <div id="content"><h1>Module: Mocha::ParameterMatchers
60
-
61
-
62
-
63
- </h1>
64
-
65
- <dl class="box">
66
-
67
-
68
-
69
-
70
-
71
-
72
-
73
- <dt class="r1">Included in:</dt>
74
- <dd class="r1"><span class='object_link'><a href="API.html" title="Mocha::API (module)">API</a></span></dd>
75
-
76
-
77
-
78
- <dt class="r2 last">Defined in:</dt>
79
- <dd class="r2 last">lib/mocha/parameter_matchers.rb<span class="defines">,<br />
80
- lib/mocha/parameter_matchers/not.rb,<br /> lib/mocha/parameter_matchers/base.rb,<br /> lib/mocha/parameter_matchers/is_a.rb,<br /> lib/mocha/parameter_matchers/any_of.rb,<br /> lib/mocha/parameter_matchers/all_of.rb,<br /> lib/mocha/parameter_matchers/equals.rb,<br /> lib/mocha/parameter_matchers/has_key.rb,<br /> lib/mocha/parameter_matchers/kind_of.rb,<br /> lib/mocha/parameter_matchers/includes.rb,<br /> lib/mocha/parameter_matchers/anything.rb,<br /> lib/mocha/parameter_matchers/has_value.rb,<br /> lib/mocha/parameter_matchers/has_entry.rb,<br /> lib/mocha/parameter_matchers/optionally.rb,<br /> lib/mocha/parameter_matchers/has_entries.rb,<br /> lib/mocha/parameter_matchers/instance_of.rb,<br /> lib/mocha/parameter_matchers/query_string.rb,<br /> lib/mocha/parameter_matchers/responds_with.rb,<br /> lib/mocha/parameter_matchers/any_parameters.rb,<br /> lib/mocha/parameter_matchers/regexp_matches.rb,<br /> lib/mocha/parameter_matchers/yaml_equivalent.rb</span>
81
- </dd>
82
-
83
- </dl>
84
- <div class="clear"></div>
85
-
86
- <h2>Overview</h2><div class="docstring">
87
- <div class="discussion">
88
-
89
- <p>Used as parameters for <span class='object_link'><a href="Expectation.html#with-instance_method" title="Mocha::Expectation#with (method)">Expectation#with</a></span> to restrict the parameter values
90
- which will match the expectation. Can be nested.</p>
91
-
92
-
93
- </div>
94
- </div>
95
- <div class="tags">
96
-
97
-
98
- </div><h2>Defined Under Namespace</h2>
99
- <p class="children">
100
-
101
-
102
-
103
-
104
- <strong class="classes">Classes:</strong> <span class='object_link'><a href="ParameterMatchers/AllOf.html" title="Mocha::ParameterMatchers::AllOf (class)">AllOf</a></span>, <span class='object_link'><a href="ParameterMatchers/AnyOf.html" title="Mocha::ParameterMatchers::AnyOf (class)">AnyOf</a></span>, <span class='object_link'><a href="ParameterMatchers/AnyParameters.html" title="Mocha::ParameterMatchers::AnyParameters (class)">AnyParameters</a></span>, <span class='object_link'><a href="ParameterMatchers/Anything.html" title="Mocha::ParameterMatchers::Anything (class)">Anything</a></span>, <span class='object_link'><a href="ParameterMatchers/Base.html" title="Mocha::ParameterMatchers::Base (class)">Base</a></span>, <span class='object_link'><a href="ParameterMatchers/Equals.html" title="Mocha::ParameterMatchers::Equals (class)">Equals</a></span>, <span class='object_link'><a href="ParameterMatchers/HasEntries.html" title="Mocha::ParameterMatchers::HasEntries (class)">HasEntries</a></span>, <span class='object_link'><a href="ParameterMatchers/HasEntry.html" title="Mocha::ParameterMatchers::HasEntry (class)">HasEntry</a></span>, <span class='object_link'><a href="ParameterMatchers/HasKey.html" title="Mocha::ParameterMatchers::HasKey (class)">HasKey</a></span>, <span class='object_link'><a href="ParameterMatchers/HasValue.html" title="Mocha::ParameterMatchers::HasValue (class)">HasValue</a></span>, <span class='object_link'><a href="ParameterMatchers/Includes.html" title="Mocha::ParameterMatchers::Includes (class)">Includes</a></span>, <span class='object_link'><a href="ParameterMatchers/InstanceOf.html" title="Mocha::ParameterMatchers::InstanceOf (class)">InstanceOf</a></span>, <span class='object_link'><a href="ParameterMatchers/IsA.html" title="Mocha::ParameterMatchers::IsA (class)">IsA</a></span>, <span class='object_link'><a href="ParameterMatchers/KindOf.html" title="Mocha::ParameterMatchers::KindOf (class)">KindOf</a></span>, <span class='object_link'><a href="ParameterMatchers/Not.html" title="Mocha::ParameterMatchers::Not (class)">Not</a></span>, <span class='object_link'><a href="ParameterMatchers/Optionally.html" title="Mocha::ParameterMatchers::Optionally (class)">Optionally</a></span>, <span class='object_link'><a href="ParameterMatchers/QueryStringMatches.html" title="Mocha::ParameterMatchers::QueryStringMatches (class)">QueryStringMatches</a></span>, <span class='object_link'><a href="ParameterMatchers/RegexpMatches.html" title="Mocha::ParameterMatchers::RegexpMatches (class)">RegexpMatches</a></span>, <span class='object_link'><a href="ParameterMatchers/RespondsWith.html" title="Mocha::ParameterMatchers::RespondsWith (class)">RespondsWith</a></span>, <span class='object_link'><a href="ParameterMatchers/YamlEquivalent.html" title="Mocha::ParameterMatchers::YamlEquivalent (class)">YamlEquivalent</a></span>
105
-
106
-
107
- </p>
108
-
109
-
110
-
111
-
112
-
113
-
114
-
115
-
116
- <h2>
117
- Instance Method Summary
118
- <small>(<a href="#" class="summary_toggle">collapse</a>)</small>
119
- </h2>
120
-
121
- <ul class="summary">
122
-
123
- <li class="public ">
124
- <span class="summary_signature">
125
-
126
- <a href="#all_of-instance_method" title="#all_of (instance method)">- (AllOf) <strong>all_of</strong>(*matchers) </a>
127
-
128
-
129
-
130
- </span>
131
-
132
-
133
-
134
-
135
-
136
-
137
-
138
-
139
- <span class="summary_desc"><div class='inline'>
140
- <p>Matches if all <tt>matchers</tt> match.</p>
141
- </div></span>
142
-
143
- </li>
144
-
145
-
146
- <li class="public ">
147
- <span class="summary_signature">
148
-
149
- <a href="#any_of-instance_method" title="#any_of (instance method)">- (AnyOf) <strong>any_of</strong>(*matchers) </a>
150
-
151
-
152
-
153
- </span>
154
-
155
-
156
-
157
-
158
-
159
-
160
-
161
-
162
- <span class="summary_desc"><div class='inline'>
163
- <p>Matches if any <tt>matchers</tt> match.</p>
164
- </div></span>
165
-
166
- </li>
167
-
168
-
169
- <li class="public ">
170
- <span class="summary_signature">
171
-
172
- <a href="#any_parameters-instance_method" title="#any_parameters (instance method)">- (AnyParameters) <strong>any_parameters</strong> </a>
173
-
174
-
175
-
176
- </span>
177
-
178
-
179
-
180
-
181
-
182
-
183
-
184
-
185
- <span class="summary_desc"><div class='inline'>
186
- <p>Matches any parameters.</p>
187
- </div></span>
188
-
189
- </li>
190
-
191
-
192
- <li class="public ">
193
- <span class="summary_signature">
194
-
195
- <a href="#anything-instance_method" title="#anything (instance method)">- (Anything) <strong>anything</strong> </a>
196
-
197
-
198
-
199
- </span>
200
-
201
-
202
-
203
-
204
-
205
-
206
-
207
-
208
- <span class="summary_desc"><div class='inline'>
209
- <p>Matches any object.</p>
210
- </div></span>
211
-
212
- </li>
213
-
214
-
215
- <li class="public ">
216
- <span class="summary_signature">
217
-
218
- <a href="#equals-instance_method" title="#equals (instance method)">- (Equals) <strong>equals</strong>(value) </a>
219
-
220
-
221
-
222
- </span>
223
-
224
-
225
-
226
-
227
-
228
-
229
-
230
-
231
- <span class="summary_desc"><div class='inline'>
232
- <p>Matches any <tt>Object</tt> equalling <tt>value</tt>.</p>
233
- </div></span>
234
-
235
- </li>
236
-
237
-
238
- <li class="public ">
239
- <span class="summary_signature">
240
-
241
- <a href="#has_entries-instance_method" title="#has_entries (instance method)">- (HasEntries) <strong>has_entries</strong>(entries) </a>
242
-
243
-
244
-
245
- </span>
246
-
247
-
248
-
249
-
250
-
251
-
252
-
253
-
254
- <span class="summary_desc"><div class='inline'>
255
- <p>Matches <tt>Hash</tt> containing all <tt>entries</tt>.</p>
256
- </div></span>
257
-
258
- </li>
259
-
260
-
261
- <li class="public ">
262
- <span class="summary_signature">
263
-
264
- <a href="#has_entry-instance_method" title="#has_entry (instance method)">- (HasEntry) <strong>has_entry</strong>(*options) </a>
265
-
266
-
267
-
268
- </span>
269
-
270
-
271
-
272
-
273
-
274
-
275
-
276
-
277
- <span class="summary_desc"><div class='inline'>
278
- <p>Matches <tt>Hash</tt> containing entry with <tt>key</tt> and
279
- <tt>value</tt>.</p>
280
- </div></span>
281
-
282
- </li>
283
-
284
-
285
- <li class="public ">
286
- <span class="summary_signature">
287
-
288
- <a href="#has_equivalent_query_string-instance_method" title="#has_equivalent_query_string (instance method)">- (QueryStringMatches) <strong>has_equivalent_query_string</strong>(uri) </a>
289
-
290
-
291
-
292
- </span>
293
-
294
-
295
-
296
-
297
-
298
-
299
-
300
-
301
- <span class="summary_desc"><div class='inline'>
302
- <p>Matches a URI without regard to the ordering of parameters in the query
303
- string.</p>
304
- </div></span>
305
-
306
- </li>
307
-
308
-
309
- <li class="public ">
310
- <span class="summary_signature">
311
-
312
- <a href="#has_key-instance_method" title="#has_key (instance method)">- (HasKey) <strong>has_key</strong>(key) </a>
313
-
314
-
315
-
316
- </span>
317
-
318
-
319
-
320
-
321
-
322
-
323
-
324
-
325
- <span class="summary_desc"><div class='inline'>
326
- <p>Matches <tt>Hash</tt> containing <tt>key</tt>.</p>
327
- </div></span>
328
-
329
- </li>
330
-
331
-
332
- <li class="public ">
333
- <span class="summary_signature">
334
-
335
- <a href="#has_value-instance_method" title="#has_value (instance method)">- (HasValue) <strong>has_value</strong>(value) </a>
336
-
337
-
338
-
339
- </span>
340
-
341
-
342
-
343
-
344
-
345
-
346
-
347
-
348
- <span class="summary_desc"><div class='inline'>
349
- <p>Matches <tt>Hash</tt> containing <tt>value</tt>.</p>
350
- </div></span>
351
-
352
- </li>
353
-
354
-
355
- <li class="public ">
356
- <span class="summary_signature">
357
-
358
- <a href="#includes-instance_method" title="#includes (instance method)">- (Includes) <strong>includes</strong>(item) </a>
359
-
360
-
361
-
362
- </span>
363
-
364
-
365
-
366
-
367
-
368
-
369
-
370
-
371
- <span class="summary_desc"><div class='inline'>
372
- <p>Matches any object that responds with <tt>true</tt> to <tt>include?(item)</tt>.</p>
373
- </div></span>
374
-
375
- </li>
376
-
377
-
378
- <li class="public ">
379
- <span class="summary_signature">
380
-
381
- <a href="#instance_of-instance_method" title="#instance_of (instance method)">- (InstanceOf) <strong>instance_of</strong>(klass) </a>
382
-
383
-
384
-
385
- </span>
386
-
387
-
388
-
389
-
390
-
391
-
392
-
393
-
394
- <span class="summary_desc"><div class='inline'>
395
- <p>Matches any object that is an instance of <tt>klass</tt>.</p>
396
- </div></span>
397
-
398
- </li>
399
-
400
-
401
- <li class="public ">
402
- <span class="summary_signature">
403
-
404
- <a href="#is_a-instance_method" title="#is_a (instance method)">- (IsA) <strong>is_a</strong>(klass) </a>
405
-
406
-
407
-
408
- </span>
409
-
410
-
411
-
412
-
413
-
414
-
415
-
416
-
417
- <span class="summary_desc"><div class='inline'>
418
- <p>Matches any object that is a <tt>klass</tt>.</p>
419
- </div></span>
420
-
421
- </li>
422
-
423
-
424
- <li class="public ">
425
- <span class="summary_signature">
426
-
427
- <a href="#kind_of-instance_method" title="#kind_of (instance method)">- (KindOf) <strong>kind_of</strong>(klass) </a>
428
-
429
-
430
-
431
- </span>
432
-
433
-
434
-
435
-
436
-
437
-
438
-
439
-
440
- <span class="summary_desc"><div class='inline'>
441
- <p>Matches any <tt>Object</tt> that is a kind of <tt>klass</tt>.</p>
442
- </div></span>
443
-
444
- </li>
445
-
446
-
447
- <li class="public ">
448
- <span class="summary_signature">
449
-
450
- <a href="#Not-instance_method" title="#Not (instance method)">- (Not) <strong>Not</strong>(matcher) </a>
451
-
452
-
453
-
454
- </span>
455
-
456
-
457
-
458
-
459
-
460
-
461
-
462
-
463
- <span class="summary_desc"><div class='inline'>
464
- <p>Matches if <tt>matcher</tt> does <b>not</b> match.</p>
465
- </div></span>
466
-
467
- </li>
468
-
469
-
470
- <li class="public ">
471
- <span class="summary_signature">
472
-
473
- <a href="#optionally-instance_method" title="#optionally (instance method)">- (Optionally) <strong>optionally</strong>(*matchers) </a>
474
-
475
-
476
-
477
- </span>
478
-
479
-
480
-
481
-
482
-
483
-
484
-
485
-
486
- <span class="summary_desc"><div class='inline'>
487
- <p>Matches optional parameters if available.</p>
488
- </div></span>
489
-
490
- </li>
491
-
492
-
493
- <li class="public ">
494
- <span class="summary_signature">
495
-
496
- <a href="#regexp_matches-instance_method" title="#regexp_matches (instance method)">- (RegexpMatches) <strong>regexp_matches</strong>(regexp) </a>
497
-
498
-
499
-
500
- </span>
501
-
502
-
503
-
504
-
505
-
506
-
507
-
508
-
509
- <span class="summary_desc"><div class='inline'>
510
- <p>Matches any object that matches <tt>regexp</tt>.</p>
511
- </div></span>
512
-
513
- </li>
514
-
515
-
516
- <li class="public ">
517
- <span class="summary_signature">
518
-
519
- <a href="#responds_with-instance_method" title="#responds_with (instance method)">- (RespondsWith) <strong>responds_with</strong>(message, result) </a>
520
-
521
-
522
-
523
- </span>
524
-
525
-
526
-
527
-
528
-
529
-
530
-
531
-
532
- <span class="summary_desc"><div class='inline'>
533
- <p>Matches any object that responds to <tt>message</tt> with <tt>result</tt>.</p>
534
- </div></span>
535
-
536
- </li>
537
-
538
-
539
- <li class="public ">
540
- <span class="summary_signature">
541
-
542
- <a href="#yaml_equivalent-instance_method" title="#yaml_equivalent (instance method)">- (YamlEquivalent) <strong>yaml_equivalent</strong>(object) </a>
543
-
544
-
545
-
546
- </span>
547
-
548
-
549
-
550
-
551
-
552
-
553
-
554
-
555
- <span class="summary_desc"><div class='inline'>
556
- <p>Matches any YAML that represents the specified <tt>object</tt>.</p>
557
- </div></span>
558
-
559
- </li>
560
-
561
-
562
- </ul>
563
-
564
-
565
-
566
-
567
- <div id="instance_method_details" class="method_details_list">
568
- <h2>Instance Method Details</h2>
569
-
570
-
571
- <div class="method_details first">
572
- <p class="signature first" id="all_of-instance_method">
573
-
574
- - (<tt><span class='object_link'><a href="ParameterMatchers/AllOf.html" title="Mocha::ParameterMatchers::AllOf (class)">AllOf</a></span></tt>) <strong>all_of</strong>(*matchers)
575
-
576
-
577
-
578
- </p><div class="docstring">
579
- <div class="discussion">
580
-
581
- <p>Matches if all <tt>matchers</tt> match.</p>
582
-
583
-
584
- </div>
585
- </div>
586
- <div class="tags">
587
-
588
- <div class="examples">
589
- <h3>Examples:</h3>
590
-
591
- <h4><div class='inline'>
592
- <p>All parameter matchers match.</p>
593
- </div></h4>
594
- <pre class="example code"><span class='id identifier rubyid_object'>object</span> <span class='op'>=</span> <span class='id identifier rubyid_mock'>mock</span><span class='lparen'>(</span><span class='rparen'>)</span>
595
- <span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_expects'>expects</span><span class='lparen'>(</span><span class='symbol'>:method_1</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_with'>with</span><span class='lparen'>(</span><span class='id identifier rubyid_all_of'>all_of</span><span class='lparen'>(</span><span class='id identifier rubyid_includes'>includes</span><span class='lparen'>(</span><span class='int'>1</span><span class='rparen'>)</span><span class='comma'>,</span> <span class='id identifier rubyid_includes'>includes</span><span class='lparen'>(</span><span class='int'>3</span><span class='rparen'>)</span><span class='rparen'>)</span><span class='rparen'>)</span>
596
- <span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_method_1'>method_1</span><span class='lparen'>(</span><span class='lbracket'>[</span><span class='int'>1</span><span class='comma'>,</span> <span class='int'>3</span><span class='rbracket'>]</span><span class='rparen'>)</span>
597
- <span class='comment'># no error raised</span></pre>
598
-
599
- <h4><div class='inline'>
600
- <p>One of the parameter matchers does not match.</p>
601
- </div></h4>
602
- <pre class="example code"><span class='id identifier rubyid_object'>object</span> <span class='op'>=</span> <span class='id identifier rubyid_mock'>mock</span><span class='lparen'>(</span><span class='rparen'>)</span>
603
- <span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_expects'>expects</span><span class='lparen'>(</span><span class='symbol'>:method_1</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_with'>with</span><span class='lparen'>(</span><span class='id identifier rubyid_all_of'>all_of</span><span class='lparen'>(</span><span class='id identifier rubyid_includes'>includes</span><span class='lparen'>(</span><span class='int'>1</span><span class='rparen'>)</span><span class='comma'>,</span> <span class='id identifier rubyid_includes'>includes</span><span class='lparen'>(</span><span class='int'>3</span><span class='rparen'>)</span><span class='rparen'>)</span><span class='rparen'>)</span>
604
- <span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_method_1'>method_1</span><span class='lparen'>(</span><span class='lbracket'>[</span><span class='int'>1</span><span class='comma'>,</span> <span class='int'>2</span><span class='rbracket'>]</span><span class='rparen'>)</span>
605
- <span class='comment'># error raised, because method_1 was not called with object including 1 and 3</span></pre>
606
-
607
- </div>
608
- <h3>Parameters:</h3>
609
- <ul class="param">
610
-
611
- <li>
612
-
613
- <span class='name'>parameter_matchers</span>
614
-
615
-
616
- <span class='type'>(<tt>*Array&lt;<span class='object_link'><a href="ParameterMatchers/Base.html" title="Mocha::ParameterMatchers::Base (class)">Base</a></span>&gt;</tt>)</span>
617
-
618
-
619
-
620
- &mdash;
621
- <div class='inline'>
622
- <p>parameter matchers.</p>
623
- </div>
624
-
625
- </li>
626
-
627
- </ul>
628
-
629
- <h3>Returns:</h3>
630
- <ul class="return">
631
-
632
- <li>
633
-
634
-
635
- <span class='type'>(<tt><span class='object_link'><a href="ParameterMatchers/AllOf.html" title="Mocha::ParameterMatchers::AllOf (class)">AllOf</a></span></tt>)</span>
636
-
637
-
638
-
639
- &mdash;
640
- <div class='inline'>
641
- <p>parameter matcher.</p>
642
- </div>
643
-
644
- </li>
645
-
646
- </ul>
647
-
648
- <h3>See Also:</h3>
649
- <ul class="see">
650
-
651
- <li><span class='object_link'><a href="Expectation.html#with-instance_method" title="Mocha::Expectation#with (method)">Expectation#with</a></span></li>
652
-
653
- </ul>
654
-
655
- </div><table class="source_code">
656
- <tr>
657
- <td>
658
- <pre class="lines">
659
-
660
-
661
- 25
662
- 26
663
- 27</pre>
664
- </td>
665
- <td>
666
- <pre class="code"><span class="info file"># File 'lib/mocha/parameter_matchers/all_of.rb', line 25</span>
667
-
668
- <span class='kw'>def</span> <span class='id identifier rubyid_all_of'>all_of</span><span class='lparen'>(</span><span class='op'>*</span><span class='id identifier rubyid_matchers'>matchers</span><span class='rparen'>)</span>
669
- <span class='const'>AllOf</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='op'>*</span><span class='id identifier rubyid_matchers'>matchers</span><span class='rparen'>)</span>
670
- <span class='kw'>end</span></pre>
671
- </td>
672
- </tr>
673
- </table>
674
- </div>
675
-
676
- <div class="method_details ">
677
- <p class="signature " id="any_of-instance_method">
678
-
679
- - (<tt><span class='object_link'><a href="ParameterMatchers/AnyOf.html" title="Mocha::ParameterMatchers::AnyOf (class)">AnyOf</a></span></tt>) <strong>any_of</strong>(*matchers)
680
-
681
-
682
-
683
- </p><div class="docstring">
684
- <div class="discussion">
685
-
686
- <p>Matches if any <tt>matchers</tt> match.</p>
687
-
688
-
689
- </div>
690
- </div>
691
- <div class="tags">
692
-
693
- <div class="examples">
694
- <h3>Examples:</h3>
695
-
696
- <h4><div class='inline'>
697
- <p>One parameter matcher matches.</p>
698
- </div></h4>
699
- <pre class="example code"><span class='id identifier rubyid_object'>object</span> <span class='op'>=</span> <span class='id identifier rubyid_mock'>mock</span><span class='lparen'>(</span><span class='rparen'>)</span>
700
- <span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_expects'>expects</span><span class='lparen'>(</span><span class='symbol'>:method_1</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_with'>with</span><span class='lparen'>(</span><span class='id identifier rubyid_any_of'>any_of</span><span class='lparen'>(</span><span class='int'>1</span><span class='comma'>,</span> <span class='int'>3</span><span class='rparen'>)</span><span class='rparen'>)</span>
701
- <span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_method_1'>method_1</span><span class='lparen'>(</span><span class='int'>1</span><span class='rparen'>)</span>
702
- <span class='comment'># no error raised</span></pre>
703
-
704
- <h4><div class='inline'>
705
- <p>The other parameter matcher matches.</p>
706
- </div></h4>
707
- <pre class="example code"><span class='id identifier rubyid_object'>object</span> <span class='op'>=</span> <span class='id identifier rubyid_mock'>mock</span><span class='lparen'>(</span><span class='rparen'>)</span>
708
- <span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_expects'>expects</span><span class='lparen'>(</span><span class='symbol'>:method_1</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_with'>with</span><span class='lparen'>(</span><span class='id identifier rubyid_any_of'>any_of</span><span class='lparen'>(</span><span class='int'>1</span><span class='comma'>,</span> <span class='int'>3</span><span class='rparen'>)</span><span class='rparen'>)</span>
709
- <span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_method_1'>method_1</span><span class='lparen'>(</span><span class='int'>3</span><span class='rparen'>)</span>
710
- <span class='comment'># no error raised</span></pre>
711
-
712
- <h4><div class='inline'>
713
- <p>Neither parameter matcher matches.</p>
714
- </div></h4>
715
- <pre class="example code"><span class='id identifier rubyid_object'>object</span> <span class='op'>=</span> <span class='id identifier rubyid_mock'>mock</span><span class='lparen'>(</span><span class='rparen'>)</span>
716
- <span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_expects'>expects</span><span class='lparen'>(</span><span class='symbol'>:method_1</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_with'>with</span><span class='lparen'>(</span><span class='id identifier rubyid_any_of'>any_of</span><span class='lparen'>(</span><span class='int'>1</span><span class='comma'>,</span> <span class='int'>3</span><span class='rparen'>)</span><span class='rparen'>)</span>
717
- <span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_method_1'>method_1</span><span class='lparen'>(</span><span class='int'>2</span><span class='rparen'>)</span>
718
- <span class='comment'># error raised, because method_1 was not called with 1 or 3</span></pre>
719
-
720
- </div>
721
- <h3>Parameters:</h3>
722
- <ul class="param">
723
-
724
- <li>
725
-
726
- <span class='name'>parameter_matchers</span>
727
-
728
-
729
- <span class='type'>(<tt>*Array&lt;<span class='object_link'><a href="ParameterMatchers/Base.html" title="Mocha::ParameterMatchers::Base (class)">Base</a></span>&gt;</tt>)</span>
730
-
731
-
732
-
733
- &mdash;
734
- <div class='inline'>
735
- <p>parameter matchers.</p>
736
- </div>
737
-
738
- </li>
739
-
740
- </ul>
741
-
742
- <h3>Returns:</h3>
743
- <ul class="return">
744
-
745
- <li>
746
-
747
-
748
- <span class='type'>(<tt><span class='object_link'><a href="ParameterMatchers/AnyOf.html" title="Mocha::ParameterMatchers::AnyOf (class)">AnyOf</a></span></tt>)</span>
749
-
750
-
751
-
752
- &mdash;
753
- <div class='inline'>
754
- <p>parameter matcher.</p>
755
- </div>
756
-
757
- </li>
758
-
759
- </ul>
760
-
761
- <h3>See Also:</h3>
762
- <ul class="see">
763
-
764
- <li><span class='object_link'><a href="Expectation.html#with-instance_method" title="Mocha::Expectation#with (method)">Expectation#with</a></span></li>
765
-
766
- </ul>
767
-
768
- </div><table class="source_code">
769
- <tr>
770
- <td>
771
- <pre class="lines">
772
-
773
-
774
- 31
775
- 32
776
- 33</pre>
777
- </td>
778
- <td>
779
- <pre class="code"><span class="info file"># File 'lib/mocha/parameter_matchers/any_of.rb', line 31</span>
780
-
781
- <span class='kw'>def</span> <span class='id identifier rubyid_any_of'>any_of</span><span class='lparen'>(</span><span class='op'>*</span><span class='id identifier rubyid_matchers'>matchers</span><span class='rparen'>)</span>
782
- <span class='const'>AnyOf</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='op'>*</span><span class='id identifier rubyid_matchers'>matchers</span><span class='rparen'>)</span>
783
- <span class='kw'>end</span></pre>
784
- </td>
785
- </tr>
786
- </table>
787
- </div>
788
-
789
- <div class="method_details ">
790
- <p class="signature " id="any_parameters-instance_method">
791
-
792
- - (<tt><span class='object_link'><a href="ParameterMatchers/AnyParameters.html" title="Mocha::ParameterMatchers::AnyParameters (class)">AnyParameters</a></span></tt>) <strong>any_parameters</strong>
793
-
794
-
795
-
796
- </p><div class="docstring">
797
- <div class="discussion">
798
-
799
- <p>Matches any parameters. This is used as the default for a newly built
800
- expectation.</p>
801
-
802
-
803
- </div>
804
- </div>
805
- <div class="tags">
806
-
807
- <div class="examples">
808
- <h3>Examples:</h3>
809
-
810
- <h4><div class='inline'>
811
- <p>Any parameters will match.</p>
812
- </div></h4>
813
- <pre class="example code"><span class='id identifier rubyid_object'>object</span> <span class='op'>=</span> <span class='id identifier rubyid_mock'>mock</span><span class='lparen'>(</span><span class='rparen'>)</span>
814
- <span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_expects'>expects</span><span class='lparen'>(</span><span class='symbol'>:method_1</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_with'>with</span><span class='lparen'>(</span><span class='id identifier rubyid_any_parameters'>any_parameters</span><span class='rparen'>)</span>
815
- <span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_method_1'>method_1</span><span class='lparen'>(</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='int'>4</span><span class='rparen'>)</span>
816
- <span class='comment'># no error raised
817
- </span>
818
- <span class='id identifier rubyid_object'>object</span> <span class='op'>=</span> <span class='id identifier rubyid_mock'>mock</span><span class='lparen'>(</span><span class='rparen'>)</span>
819
- <span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_expects'>expects</span><span class='lparen'>(</span><span class='symbol'>:method_1</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_with'>with</span><span class='lparen'>(</span><span class='id identifier rubyid_any_parameters'>any_parameters</span><span class='rparen'>)</span>
820
- <span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_method_1'>method_1</span><span class='lparen'>(</span><span class='int'>5</span><span class='comma'>,</span> <span class='int'>6</span><span class='comma'>,</span> <span class='int'>7</span><span class='comma'>,</span> <span class='int'>8</span><span class='comma'>,</span> <span class='int'>9</span><span class='comma'>,</span> <span class='int'>0</span><span class='rparen'>)</span>
821
- <span class='comment'># no error raised</span></pre>
822
-
823
- </div>
824
-
825
- <h3>Returns:</h3>
826
- <ul class="return">
827
-
828
- <li>
829
-
830
-
831
- <span class='type'>(<tt><span class='object_link'><a href="ParameterMatchers/AnyParameters.html" title="Mocha::ParameterMatchers::AnyParameters (class)">AnyParameters</a></span></tt>)</span>
832
-
833
-
834
-
835
- &mdash;
836
- <div class='inline'>
837
- <p>parameter matcher.</p>
838
- </div>
839
-
840
- </li>
841
-
842
- </ul>
843
-
844
- <h3>See Also:</h3>
845
- <ul class="see">
846
-
847
- <li><span class='object_link'><a href="Expectation.html#with-instance_method" title="Mocha::Expectation#with (method)">Expectation#with</a></span></li>
848
-
849
- </ul>
850
-
851
- </div><table class="source_code">
852
- <tr>
853
- <td>
854
- <pre class="lines">
855
-
856
-
857
- 23
858
- 24
859
- 25</pre>
860
- </td>
861
- <td>
862
- <pre class="code"><span class="info file"># File 'lib/mocha/parameter_matchers/any_parameters.rb', line 23</span>
863
-
864
- <span class='kw'>def</span> <span class='id identifier rubyid_any_parameters'>any_parameters</span>
865
- <span class='const'>AnyParameters</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span>
866
- <span class='kw'>end</span></pre>
867
- </td>
868
- </tr>
869
- </table>
870
- </div>
871
-
872
- <div class="method_details ">
873
- <p class="signature " id="anything-instance_method">
874
-
875
- - (<tt><span class='object_link'><a href="ParameterMatchers/Anything.html" title="Mocha::ParameterMatchers::Anything (class)">Anything</a></span></tt>) <strong>anything</strong>
876
-
877
-
878
-
879
- </p><div class="docstring">
880
- <div class="discussion">
881
-
882
- <p>Matches any object.</p>
883
-
884
-
885
- </div>
886
- </div>
887
- <div class="tags">
888
-
889
- <div class="examples">
890
- <h3>Examples:</h3>
891
-
892
- <h4><div class='inline'>
893
- <p>Any object will match.</p>
894
- </div></h4>
895
- <pre class="example code"><span class='id identifier rubyid_object'>object</span> <span class='op'>=</span> <span class='id identifier rubyid_mock'>mock</span><span class='lparen'>(</span><span class='rparen'>)</span>
896
- <span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_expects'>expects</span><span class='lparen'>(</span><span class='symbol'>:method_1</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_with'>with</span><span class='lparen'>(</span><span class='id identifier rubyid_anything'>anything</span><span class='rparen'>)</span>
897
- <span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_method_1'>method_1</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>foo</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span>
898
- <span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_method_1'>method_1</span><span class='lparen'>(</span><span class='int'>789</span><span class='rparen'>)</span>
899
- <span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_method_1'>method_1</span><span class='lparen'>(</span><span class='symbol'>:bar</span><span class='rparen'>)</span>
900
- <span class='comment'># no error raised</span></pre>
901
-
902
- </div>
903
-
904
- <h3>Returns:</h3>
905
- <ul class="return">
906
-
907
- <li>
908
-
909
-
910
- <span class='type'>(<tt><span class='object_link'><a href="ParameterMatchers/Anything.html" title="Mocha::ParameterMatchers::Anything (class)">Anything</a></span></tt>)</span>
911
-
912
-
913
-
914
- &mdash;
915
- <div class='inline'>
916
- <p>parameter matcher.</p>
917
- </div>
918
-
919
- </li>
920
-
921
- </ul>
922
-
923
- <h3>See Also:</h3>
924
- <ul class="see">
925
-
926
- <li><span class='object_link'><a href="Expectation.html#with-instance_method" title="Mocha::Expectation#with (method)">Expectation#with</a></span></li>
927
-
928
- </ul>
929
-
930
- </div><table class="source_code">
931
- <tr>
932
- <td>
933
- <pre class="lines">
934
-
935
-
936
- 20
937
- 21
938
- 22</pre>
939
- </td>
940
- <td>
941
- <pre class="code"><span class="info file"># File 'lib/mocha/parameter_matchers/anything.rb', line 20</span>
942
-
943
- <span class='kw'>def</span> <span class='id identifier rubyid_anything'>anything</span>
944
- <span class='const'>Anything</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span>
945
- <span class='kw'>end</span></pre>
946
- </td>
947
- </tr>
948
- </table>
949
- </div>
950
-
951
- <div class="method_details ">
952
- <p class="signature " id="equals-instance_method">
953
-
954
- - (<tt><span class='object_link'><a href="ParameterMatchers/Equals.html" title="Mocha::ParameterMatchers::Equals (class)">Equals</a></span></tt>) <strong>equals</strong>(value)
955
-
956
-
957
-
958
- </p><div class="docstring">
959
- <div class="discussion">
960
-
961
- <p>Matches any <tt>Object</tt> equalling <tt>value</tt>.</p>
962
-
963
-
964
- </div>
965
- </div>
966
- <div class="tags">
967
-
968
- <div class="examples">
969
- <h3>Examples:</h3>
970
-
971
- <h4><div class='inline'>
972
- <p>Actual parameter equals expected parameter.</p>
973
- </div></h4>
974
- <pre class="example code"><span class='id identifier rubyid_object'>object</span> <span class='op'>=</span> <span class='id identifier rubyid_mock'>mock</span><span class='lparen'>(</span><span class='rparen'>)</span>
975
- <span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_expects'>expects</span><span class='lparen'>(</span><span class='symbol'>:method_1</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_with'>with</span><span class='lparen'>(</span><span class='id identifier rubyid_equals'>equals</span><span class='lparen'>(</span><span class='int'>2</span><span class='rparen'>)</span><span class='rparen'>)</span>
976
- <span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_method_1'>method_1</span><span class='lparen'>(</span><span class='int'>2</span><span class='rparen'>)</span>
977
- <span class='comment'># no error raised</span></pre>
978
-
979
- <h4><div class='inline'>
980
- <p>Actual parameter does not equal expected parameter.</p>
981
- </div></h4>
982
- <pre class="example code"><span class='id identifier rubyid_object'>object</span> <span class='op'>=</span> <span class='id identifier rubyid_mock'>mock</span><span class='lparen'>(</span><span class='rparen'>)</span>
983
- <span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_expects'>expects</span><span class='lparen'>(</span><span class='symbol'>:method_1</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_with'>with</span><span class='lparen'>(</span><span class='id identifier rubyid_equals'>equals</span><span class='lparen'>(</span><span class='int'>2</span><span class='rparen'>)</span><span class='rparen'>)</span>
984
- <span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_method_1'>method_1</span><span class='lparen'>(</span><span class='int'>3</span><span class='rparen'>)</span>
985
- <span class='comment'># error raised, because method_1 was not called with an +Object+ that equals 3</span></pre>
986
-
987
- </div>
988
- <h3>Parameters:</h3>
989
- <ul class="param">
990
-
991
- <li>
992
-
993
- <span class='name'>value</span>
994
-
995
-
996
- <span class='type'>(<tt><span class='object_link'><a href="../Object.html" title="Object (class)">Object</a></span></tt>)</span>
997
-
998
-
999
-
1000
- &mdash;
1001
- <div class='inline'>
1002
- <p>expected value.</p>
1003
- </div>
1004
-
1005
- </li>
1006
-
1007
- </ul>
1008
-
1009
- <h3>Returns:</h3>
1010
- <ul class="return">
1011
-
1012
- <li>
1013
-
1014
-
1015
- <span class='type'>(<tt><span class='object_link'><a href="ParameterMatchers/Equals.html" title="Mocha::ParameterMatchers::Equals (class)">Equals</a></span></tt>)</span>
1016
-
1017
-
1018
-
1019
- &mdash;
1020
- <div class='inline'>
1021
- <p>parameter matcher.</p>
1022
- </div>
1023
-
1024
- </li>
1025
-
1026
- </ul>
1027
-
1028
- <h3>See Also:</h3>
1029
- <ul class="see">
1030
-
1031
- <li><span class='object_link'><a href="Expectation.html#with-instance_method" title="Mocha::Expectation#with (method)">Expectation#with</a></span></li>
1032
-
1033
- <li>Object#==</li>
1034
-
1035
- </ul>
1036
-
1037
- </div><table class="source_code">
1038
- <tr>
1039
- <td>
1040
- <pre class="lines">
1041
-
1042
-
1043
- 26
1044
- 27
1045
- 28</pre>
1046
- </td>
1047
- <td>
1048
- <pre class="code"><span class="info file"># File 'lib/mocha/parameter_matchers/equals.rb', line 26</span>
1049
-
1050
- <span class='kw'>def</span> <span class='id identifier rubyid_equals'>equals</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span><span class='rparen'>)</span>
1051
- <span class='const'>Equals</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span><span class='rparen'>)</span>
1052
- <span class='kw'>end</span></pre>
1053
- </td>
1054
- </tr>
1055
- </table>
1056
- </div>
1057
-
1058
- <div class="method_details ">
1059
- <p class="signature " id="has_entries-instance_method">
1060
-
1061
- - (<tt><span class='object_link'><a href="ParameterMatchers/HasEntries.html" title="Mocha::ParameterMatchers::HasEntries (class)">HasEntries</a></span></tt>) <strong>has_entries</strong>(entries)
1062
-
1063
-
1064
-
1065
- </p><div class="docstring">
1066
- <div class="discussion">
1067
-
1068
- <p>Matches <tt>Hash</tt> containing all <tt>entries</tt>.</p>
1069
-
1070
-
1071
- </div>
1072
- </div>
1073
- <div class="tags">
1074
-
1075
- <div class="examples">
1076
- <h3>Examples:</h3>
1077
-
1078
- <h4><div class='inline'>
1079
- <p>Actual parameter contains all expected entries.</p>
1080
- </div></h4>
1081
- <pre class="example code"><span class='id identifier rubyid_object'>object</span> <span class='op'>=</span> <span class='id identifier rubyid_mock'>mock</span><span class='lparen'>(</span><span class='rparen'>)</span>
1082
- <span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_expects'>expects</span><span class='lparen'>(</span><span class='symbol'>:method_1</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_with'>with</span><span class='lparen'>(</span><span class='id identifier rubyid_has_entries'>has_entries</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>key_1</span><span class='tstring_end'>'</span></span> <span class='op'>=&gt;</span> <span class='int'>1</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>key_2</span><span class='tstring_end'>'</span></span> <span class='op'>=&gt;</span> <span class='int'>2</span><span class='rparen'>)</span><span class='rparen'>)</span>
1083
- <span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_method_1'>method_1</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>key_1</span><span class='tstring_end'>'</span></span> <span class='op'>=&gt;</span> <span class='int'>1</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>key_2</span><span class='tstring_end'>'</span></span> <span class='op'>=&gt;</span> <span class='int'>2</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>key_3</span><span class='tstring_end'>'</span></span> <span class='op'>=&gt;</span> <span class='int'>3</span><span class='rparen'>)</span>
1084
- <span class='comment'># no error raised</span></pre>
1085
-
1086
- <h4><div class='inline'>
1087
- <p>Actual parameter does not contain all expected entries.</p>
1088
- </div></h4>
1089
- <pre class="example code"><span class='id identifier rubyid_object'>object</span> <span class='op'>=</span> <span class='id identifier rubyid_mock'>mock</span><span class='lparen'>(</span><span class='rparen'>)</span>
1090
- <span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_expects'>expects</span><span class='lparen'>(</span><span class='symbol'>:method_1</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_with'>with</span><span class='lparen'>(</span><span class='id identifier rubyid_has_entries'>has_entries</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>key_1</span><span class='tstring_end'>'</span></span> <span class='op'>=&gt;</span> <span class='int'>1</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>key_2</span><span class='tstring_end'>'</span></span> <span class='op'>=&gt;</span> <span class='int'>2</span><span class='rparen'>)</span><span class='rparen'>)</span>
1091
- <span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_method_1'>method_1</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>key_1</span><span class='tstring_end'>'</span></span> <span class='op'>=&gt;</span> <span class='int'>1</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>key_2</span><span class='tstring_end'>'</span></span> <span class='op'>=&gt;</span> <span class='int'>99</span><span class='rparen'>)</span>
1092
- <span class='comment'># error raised, because method_1 was not called with Hash containing entries: 'key_1' =&gt; 1, 'key_2' =&gt; 2</span></pre>
1093
-
1094
- </div>
1095
- <h3>Parameters:</h3>
1096
- <ul class="param">
1097
-
1098
- <li>
1099
-
1100
- <span class='name'>entries</span>
1101
-
1102
-
1103
- <span class='type'>(<tt>Hash</tt>)</span>
1104
-
1105
-
1106
-
1107
- &mdash;
1108
- <div class='inline'>
1109
- <p>expected <tt>Hash</tt> entries.</p>
1110
- </div>
1111
-
1112
- </li>
1113
-
1114
- </ul>
1115
-
1116
- <h3>Returns:</h3>
1117
- <ul class="return">
1118
-
1119
- <li>
1120
-
1121
-
1122
- <span class='type'>(<tt><span class='object_link'><a href="ParameterMatchers/HasEntries.html" title="Mocha::ParameterMatchers::HasEntries (class)">HasEntries</a></span></tt>)</span>
1123
-
1124
-
1125
-
1126
- &mdash;
1127
- <div class='inline'>
1128
- <p>parameter matcher.</p>
1129
- </div>
1130
-
1131
- </li>
1132
-
1133
- </ul>
1134
-
1135
- <h3>See Also:</h3>
1136
- <ul class="see">
1137
-
1138
- <li><span class='object_link'><a href="Expectation.html#with-instance_method" title="Mocha::Expectation#with (method)">Expectation#with</a></span></li>
1139
-
1140
- </ul>
1141
-
1142
- </div><table class="source_code">
1143
- <tr>
1144
- <td>
1145
- <pre class="lines">
1146
-
1147
-
1148
- 27
1149
- 28
1150
- 29</pre>
1151
- </td>
1152
- <td>
1153
- <pre class="code"><span class="info file"># File 'lib/mocha/parameter_matchers/has_entries.rb', line 27</span>
1154
-
1155
- <span class='kw'>def</span> <span class='id identifier rubyid_has_entries'>has_entries</span><span class='lparen'>(</span><span class='id identifier rubyid_entries'>entries</span><span class='rparen'>)</span>
1156
- <span class='const'>HasEntries</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_entries'>entries</span><span class='rparen'>)</span>
1157
- <span class='kw'>end</span></pre>
1158
- </td>
1159
- </tr>
1160
- </table>
1161
- </div>
1162
-
1163
- <div class="method_details ">
1164
- <p class="signature " id="has_entry-instance_method">
1165
-
1166
-
1167
- <span class="overload">- (<tt><span class='object_link'><a href="ParameterMatchers/HasEntry.html" title="Mocha::ParameterMatchers::HasEntry (class)">HasEntry</a></span></tt>) <strong>has_entry</strong>(key, value) </span>
1168
-
1169
- <span class="overload">- (<tt><span class='object_link'><a href="ParameterMatchers/HasEntry.html" title="Mocha::ParameterMatchers::HasEntry (class)">HasEntry</a></span></tt>) <strong>has_entry</strong>(single_entry_hash) </span>
1170
-
1171
-
1172
-
1173
-
1174
- </p><div class="docstring">
1175
- <div class="discussion">
1176
-
1177
- <p>Matches <tt>Hash</tt> containing entry with <tt>key</tt> and
1178
- <tt>value</tt>.</p>
1179
-
1180
-
1181
- </div>
1182
- </div>
1183
- <div class="tags">
1184
-
1185
- <div class="examples">
1186
- <h3>Examples:</h3>
1187
-
1188
- <h4><div class='inline'>
1189
- <p>Actual parameter contains expected entry supplied as key and value.</p>
1190
- </div></h4>
1191
- <pre class="example code"><span class='id identifier rubyid_object'>object</span> <span class='op'>=</span> <span class='id identifier rubyid_mock'>mock</span><span class='lparen'>(</span><span class='rparen'>)</span>
1192
- <span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_expects'>expects</span><span class='lparen'>(</span><span class='symbol'>:method_1</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_with'>with</span><span class='lparen'>(</span><span class='id identifier rubyid_has_entry'>has_entry</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>key_1</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='int'>1</span><span class='rparen'>)</span><span class='rparen'>)</span>
1193
- <span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_method_1'>method_1</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>key_1</span><span class='tstring_end'>'</span></span> <span class='op'>=&gt;</span> <span class='int'>1</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>key_2</span><span class='tstring_end'>'</span></span> <span class='op'>=&gt;</span> <span class='int'>2</span><span class='rparen'>)</span>
1194
- <span class='comment'># no error raised</span></pre>
1195
-
1196
- <h4><div class='inline'>
1197
- <p>Actual parameter contains expected entry supplied as <tt>Hash</tt> entry.</p>
1198
- </div></h4>
1199
- <pre class="example code"><span class='id identifier rubyid_object'>object</span> <span class='op'>=</span> <span class='id identifier rubyid_mock'>mock</span><span class='lparen'>(</span><span class='rparen'>)</span>
1200
- <span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_expects'>expects</span><span class='lparen'>(</span><span class='symbol'>:method_1</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_with'>with</span><span class='lparen'>(</span><span class='id identifier rubyid_has_entry'>has_entry</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>key_1</span><span class='tstring_end'>'</span></span> <span class='op'>=&gt;</span> <span class='int'>1</span><span class='rparen'>)</span><span class='rparen'>)</span>
1201
- <span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_method_1'>method_1</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>key_1</span><span class='tstring_end'>'</span></span> <span class='op'>=&gt;</span> <span class='int'>1</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>key_2</span><span class='tstring_end'>'</span></span> <span class='op'>=&gt;</span> <span class='int'>2</span><span class='rparen'>)</span>
1202
- <span class='comment'># no error raised</span></pre>
1203
-
1204
- <h4><div class='inline'>
1205
- <p>Actual parameter does not contain expected entry supplied as key and value.</p>
1206
- </div></h4>
1207
- <pre class="example code"><span class='id identifier rubyid_object'>object</span> <span class='op'>=</span> <span class='id identifier rubyid_mock'>mock</span><span class='lparen'>(</span><span class='rparen'>)</span>
1208
- <span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_expects'>expects</span><span class='lparen'>(</span><span class='symbol'>:method_1</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_with'>with</span><span class='lparen'>(</span><span class='id identifier rubyid_has_entry'>has_entry</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>key_1</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='int'>1</span><span class='rparen'>)</span><span class='rparen'>)</span>
1209
- <span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_method_1'>method_1</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>key_1</span><span class='tstring_end'>'</span></span> <span class='op'>=&gt;</span> <span class='int'>2</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>key_2</span><span class='tstring_end'>'</span></span> <span class='op'>=&gt;</span> <span class='int'>1</span><span class='rparen'>)</span>
1210
- <span class='comment'># error raised, because method_1 was not called with Hash containing entry: 'key_1' =&gt; 1</span></pre>
1211
-
1212
- <h4><div class='inline'>
1213
- <p>Actual parameter does not contain expected entry supplied as <tt>Hash</tt>
1214
- entry.</p>
1215
- </div></h4>
1216
- <pre class="example code">
1217
- <span class='id identifier rubyid_object'>object</span> <span class='op'>=</span> <span class='id identifier rubyid_mock'>mock</span><span class='lparen'>(</span><span class='rparen'>)</span>
1218
- <span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_expects'>expects</span><span class='lparen'>(</span><span class='symbol'>:method_1</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_with'>with</span><span class='lparen'>(</span><span class='id identifier rubyid_has_entry'>has_entry</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>key_1</span><span class='tstring_end'>'</span></span> <span class='op'>=&gt;</span> <span class='int'>1</span><span class='rparen'>)</span><span class='rparen'>)</span>
1219
- <span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_method_1'>method_1</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>key_1</span><span class='tstring_end'>'</span></span> <span class='op'>=&gt;</span> <span class='int'>2</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>key_2</span><span class='tstring_end'>'</span></span> <span class='op'>=&gt;</span> <span class='int'>1</span><span class='rparen'>)</span>
1220
- <span class='comment'># error raised, because method_1 was not called with Hash containing entry: 'key_1' =&gt; 1</span></pre>
1221
-
1222
- </div>
1223
-
1224
- <h3>Overloads:</h3>
1225
- <ul class="overload">
1226
-
1227
-
1228
- <li class="overload_item">
1229
- <span class="signature">- (<tt><span class='object_link'><a href="ParameterMatchers/HasEntry.html" title="Mocha::ParameterMatchers::HasEntry (class)">HasEntry</a></span></tt>) <strong>has_entry</strong>(key, value) </span>
1230
- <div class="docstring">
1231
- <div class="discussion">
1232
-
1233
-
1234
- </div>
1235
- </div>
1236
- <div class="tags">
1237
- <h3>Parameters:</h3>
1238
- <ul class="param">
1239
-
1240
- <li>
1241
-
1242
- <span class='name'>key</span>
1243
-
1244
-
1245
- <span class='type'>(<tt><span class='object_link'><a href="../Object.html" title="Object (class)">Object</a></span></tt>)</span>
1246
-
1247
-
1248
-
1249
- &mdash;
1250
- <div class='inline'>
1251
- <p>key for entry.</p>
1252
- </div>
1253
-
1254
- </li>
1255
-
1256
- <li>
1257
-
1258
- <span class='name'>value</span>
1259
-
1260
-
1261
- <span class='type'>(<tt><span class='object_link'><a href="../Object.html" title="Object (class)">Object</a></span></tt>)</span>
1262
-
1263
-
1264
-
1265
- &mdash;
1266
- <div class='inline'>
1267
- <p>value for entry.</p>
1268
- </div>
1269
-
1270
- </li>
1271
-
1272
- </ul>
1273
-
1274
-
1275
- </div>
1276
- </li>
1277
-
1278
-
1279
- <li class="overload_item">
1280
- <span class="signature">- (<tt><span class='object_link'><a href="ParameterMatchers/HasEntry.html" title="Mocha::ParameterMatchers::HasEntry (class)">HasEntry</a></span></tt>) <strong>has_entry</strong>(single_entry_hash) </span>
1281
- <div class="docstring">
1282
- <div class="discussion">
1283
-
1284
-
1285
- </div>
1286
- </div>
1287
- <div class="tags">
1288
- <h3>Parameters:</h3>
1289
- <ul class="param">
1290
-
1291
- <li>
1292
-
1293
- <span class='name'>single_entry_hash</span>
1294
-
1295
-
1296
- <span class='type'>(<tt>Hash</tt>)</span>
1297
-
1298
-
1299
-
1300
- &mdash;
1301
- <div class='inline'>
1302
- <p><tt>Hash</tt> with single entry.</p>
1303
- </div>
1304
-
1305
- </li>
1306
-
1307
- </ul>
1308
-
1309
- <h3>Raises:</h3>
1310
- <ul class="raise">
1311
-
1312
- <li>
1313
-
1314
-
1315
- <span class='type'>(<tt>ArgumentError</tt>)</span>
1316
-
1317
-
1318
-
1319
- &mdash;
1320
- <div class='inline'>
1321
- <p>if <tt>single_entry_hash</tt> does not contain exactly one entry.</p>
1322
- </div>
1323
-
1324
- </li>
1325
-
1326
- </ul>
1327
-
1328
- </div>
1329
- </li>
1330
-
1331
- </ul>
1332
-
1333
- <h3>Returns:</h3>
1334
- <ul class="return">
1335
-
1336
- <li>
1337
-
1338
-
1339
- <span class='type'>(<tt><span class='object_link'><a href="ParameterMatchers/HasEntry.html" title="Mocha::ParameterMatchers::HasEntry (class)">HasEntry</a></span></tt>)</span>
1340
-
1341
-
1342
-
1343
- &mdash;
1344
- <div class='inline'>
1345
- <p>parameter matcher.</p>
1346
- </div>
1347
-
1348
- </li>
1349
-
1350
- </ul>
1351
-
1352
- <h3>See Also:</h3>
1353
- <ul class="see">
1354
-
1355
- <li><span class='object_link'><a href="Expectation.html#with-instance_method" title="Mocha::Expectation#with (method)">Expectation#with</a></span></li>
1356
-
1357
- </ul>
1358
-
1359
- </div><table class="source_code">
1360
- <tr>
1361
- <td>
1362
- <pre class="lines">
1363
-
1364
-
1365
- 44
1366
- 45
1367
- 46
1368
- 47
1369
- 48
1370
- 49
1371
- 50
1372
- 51
1373
- 52
1374
- 53
1375
- 54
1376
- 55
1377
- 56
1378
- 57</pre>
1379
- </td>
1380
- <td>
1381
- <pre class="code"><span class="info file"># File 'lib/mocha/parameter_matchers/has_entry.rb', line 44</span>
1382
-
1383
- <span class='kw'>def</span> <span class='id identifier rubyid_has_entry'>has_entry</span><span class='lparen'>(</span><span class='op'>*</span><span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
1384
- <span class='id identifier rubyid_key'>key</span><span class='comma'>,</span> <span class='id identifier rubyid_value'>value</span> <span class='op'>=</span> <span class='id identifier rubyid_options'>options</span><span class='period'>.</span><span class='id identifier rubyid_shift'>shift</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span><span class='period'>.</span><span class='id identifier rubyid_shift'>shift</span>
1385
- <span class='kw'>if</span> <span class='id identifier rubyid_key'>key</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>Hash</span><span class='rparen'>)</span>
1386
- <span class='kw'>case</span> <span class='id identifier rubyid_key'>key</span><span class='period'>.</span><span class='id identifier rubyid_length'>length</span>
1387
- <span class='kw'>when</span> <span class='int'>0</span>
1388
- <span class='id identifier rubyid_raise'>raise</span> <span class='const'>ArgumentError</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Argument has no entries.</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
1389
- <span class='kw'>when</span> <span class='int'>1</span>
1390
- <span class='id identifier rubyid_key'>key</span><span class='comma'>,</span> <span class='id identifier rubyid_value'>value</span> <span class='op'>=</span> <span class='id identifier rubyid_key'>key</span><span class='period'>.</span><span class='id identifier rubyid_to_a'>to_a</span><span class='period'>.</span><span class='id identifier rubyid_flatten'>flatten</span>
1391
- <span class='kw'>else</span>
1392
- <span class='id identifier rubyid_raise'>raise</span> <span class='const'>ArgumentError</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Argument has multiple entries. Use Mocha::ParameterMatchers#has_entries instead.</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
1393
- <span class='kw'>end</span>
1394
- <span class='kw'>end</span>
1395
- <span class='const'>HasEntry</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_key'>key</span><span class='comma'>,</span> <span class='id identifier rubyid_value'>value</span><span class='rparen'>)</span>
1396
- <span class='kw'>end</span></pre>
1397
- </td>
1398
- </tr>
1399
- </table>
1400
- </div>
1401
-
1402
- <div class="method_details ">
1403
- <p class="signature " id="has_equivalent_query_string-instance_method">
1404
-
1405
- - (<tt><span class='object_link'><a href="ParameterMatchers/QueryStringMatches.html" title="Mocha::ParameterMatchers::QueryStringMatches (class)">QueryStringMatches</a></span></tt>) <strong>has_equivalent_query_string</strong>(uri)
1406
-
1407
-
1408
-
1409
- </p><div class="docstring">
1410
- <div class="discussion">
1411
-
1412
- <p>Matches a URI without regard to the ordering of parameters in the query
1413
- string.</p>
1414
-
1415
-
1416
- </div>
1417
- </div>
1418
- <div class="tags">
1419
-
1420
- <div class="examples">
1421
- <h3>Examples:</h3>
1422
-
1423
- <h4><div class='inline'>
1424
- <p>Actual URI has equivalent query string.</p>
1425
- </div></h4>
1426
- <pre class="example code">object = mock()
1427
- object.expects(:method_1).with(has_equivalent_query_string('http://example.com/foo?a=1&amp;b=2))
1428
- object.method_1('http://example.com/foo?b=2&amp;a=1')
1429
- # no error raised</pre>
1430
-
1431
- <h4><div class='inline'>
1432
- <p>Actual URI does not have equivalent query string.</p>
1433
- </div></h4>
1434
- <pre class="example code">object = mock()
1435
- object.expects(:method_1).with(has_equivalent_query_string('http://example.com/foo?a=1&amp;b=2))
1436
- object.method_1('http://example.com/foo?a=1&amp;b=3')
1437
- # error raised, because the query parameters were different</pre>
1438
-
1439
- </div>
1440
- <h3>Parameters:</h3>
1441
- <ul class="param">
1442
-
1443
- <li>
1444
-
1445
- <span class='name'>uri</span>
1446
-
1447
-
1448
- <span class='type'>(<tt>String</tt>)</span>
1449
-
1450
-
1451
-
1452
- &mdash;
1453
- <div class='inline'>
1454
- <p>URI to match.</p>
1455
- </div>
1456
-
1457
- </li>
1458
-
1459
- </ul>
1460
-
1461
- <h3>Returns:</h3>
1462
- <ul class="return">
1463
-
1464
- <li>
1465
-
1466
-
1467
- <span class='type'>(<tt><span class='object_link'><a href="ParameterMatchers/QueryStringMatches.html" title="Mocha::ParameterMatchers::QueryStringMatches (class)">QueryStringMatches</a></span></tt>)</span>
1468
-
1469
-
1470
-
1471
- &mdash;
1472
- <div class='inline'>
1473
- <p>parameter matcher.</p>
1474
- </div>
1475
-
1476
- </li>
1477
-
1478
- </ul>
1479
-
1480
- <h3>See Also:</h3>
1481
- <ul class="see">
1482
-
1483
- <li><span class='object_link'><a href="Expectation.html#with-instance_method" title="Mocha::Expectation#with (method)">Expectation#with</a></span></li>
1484
-
1485
- </ul>
1486
-
1487
- </div><table class="source_code">
1488
- <tr>
1489
- <td>
1490
- <pre class="lines">
1491
-
1492
-
1493
- 25
1494
- 26
1495
- 27</pre>
1496
- </td>
1497
- <td>
1498
- <pre class="code"><span class="info file"># File 'lib/mocha/parameter_matchers/query_string.rb', line 25</span>
1499
-
1500
- <span class='kw'>def</span> <span class='id identifier rubyid_has_equivalent_query_string'>has_equivalent_query_string</span><span class='lparen'>(</span><span class='id identifier rubyid_uri'>uri</span><span class='rparen'>)</span>
1501
- <span class='const'>QueryStringMatches</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_uri'>uri</span><span class='rparen'>)</span>
1502
- <span class='kw'>end</span></pre>
1503
- </td>
1504
- </tr>
1505
- </table>
1506
- </div>
1507
-
1508
- <div class="method_details ">
1509
- <p class="signature " id="has_key-instance_method">
1510
-
1511
- - (<tt><span class='object_link'><a href="ParameterMatchers/HasKey.html" title="Mocha::ParameterMatchers::HasKey (class)">HasKey</a></span></tt>) <strong>has_key</strong>(key)
1512
-
1513
-
1514
-
1515
- </p><div class="docstring">
1516
- <div class="discussion">
1517
-
1518
- <p>Matches <tt>Hash</tt> containing <tt>key</tt>.</p>
1519
-
1520
-
1521
- </div>
1522
- </div>
1523
- <div class="tags">
1524
-
1525
- <div class="examples">
1526
- <h3>Examples:</h3>
1527
-
1528
- <h4><div class='inline'>
1529
- <p>Actual parameter contains entry with expected key.</p>
1530
- </div></h4>
1531
- <pre class="example code"><span class='id identifier rubyid_object'>object</span> <span class='op'>=</span> <span class='id identifier rubyid_mock'>mock</span><span class='lparen'>(</span><span class='rparen'>)</span>
1532
- <span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_expects'>expects</span><span class='lparen'>(</span><span class='symbol'>:method_1</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_with'>with</span><span class='lparen'>(</span><span class='id identifier rubyid_has_key'>has_key</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>key_1</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span><span class='rparen'>)</span>
1533
- <span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_method_1'>method_1</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>key_1</span><span class='tstring_end'>'</span></span> <span class='op'>=&gt;</span> <span class='int'>1</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>key_2</span><span class='tstring_end'>'</span></span> <span class='op'>=&gt;</span> <span class='int'>2</span><span class='rparen'>)</span>
1534
- <span class='comment'># no error raised</span></pre>
1535
-
1536
- <h4><div class='inline'>
1537
- <p>Actual parameter does not contain entry with expected key.</p>
1538
- </div></h4>
1539
- <pre class="example code"><span class='id identifier rubyid_object'>object</span> <span class='op'>=</span> <span class='id identifier rubyid_mock'>mock</span><span class='lparen'>(</span><span class='rparen'>)</span>
1540
- <span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_expects'>expects</span><span class='lparen'>(</span><span class='symbol'>:method_1</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_with'>with</span><span class='lparen'>(</span><span class='id identifier rubyid_has_key'>has_key</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>key_1</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span><span class='rparen'>)</span>
1541
- <span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_method_1'>method_1</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>key_2</span><span class='tstring_end'>'</span></span> <span class='op'>=&gt;</span> <span class='int'>2</span><span class='rparen'>)</span>
1542
- <span class='comment'># error raised, because method_1 was not called with Hash containing key: 'key_1'</span></pre>
1543
-
1544
- </div>
1545
- <h3>Parameters:</h3>
1546
- <ul class="param">
1547
-
1548
- <li>
1549
-
1550
- <span class='name'>key</span>
1551
-
1552
-
1553
- <span class='type'>(<tt><span class='object_link'><a href="../Object.html" title="Object (class)">Object</a></span></tt>)</span>
1554
-
1555
-
1556
-
1557
- &mdash;
1558
- <div class='inline'>
1559
- <p>expected key.</p>
1560
- </div>
1561
-
1562
- </li>
1563
-
1564
- </ul>
1565
-
1566
- <h3>Returns:</h3>
1567
- <ul class="return">
1568
-
1569
- <li>
1570
-
1571
-
1572
- <span class='type'>(<tt><span class='object_link'><a href="ParameterMatchers/HasKey.html" title="Mocha::ParameterMatchers::HasKey (class)">HasKey</a></span></tt>)</span>
1573
-
1574
-
1575
-
1576
- &mdash;
1577
- <div class='inline'>
1578
- <p>parameter matcher.</p>
1579
- </div>
1580
-
1581
- </li>
1582
-
1583
- </ul>
1584
-
1585
- <h3>See Also:</h3>
1586
- <ul class="see">
1587
-
1588
- <li><span class='object_link'><a href="Expectation.html#with-instance_method" title="Mocha::Expectation#with (method)">Expectation#with</a></span></li>
1589
-
1590
- </ul>
1591
-
1592
- </div><table class="source_code">
1593
- <tr>
1594
- <td>
1595
- <pre class="lines">
1596
-
1597
-
1598
- 25
1599
- 26
1600
- 27</pre>
1601
- </td>
1602
- <td>
1603
- <pre class="code"><span class="info file"># File 'lib/mocha/parameter_matchers/has_key.rb', line 25</span>
1604
-
1605
- <span class='kw'>def</span> <span class='id identifier rubyid_has_key'>has_key</span><span class='lparen'>(</span><span class='id identifier rubyid_key'>key</span><span class='rparen'>)</span>
1606
- <span class='const'>HasKey</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_key'>key</span><span class='rparen'>)</span>
1607
- <span class='kw'>end</span></pre>
1608
- </td>
1609
- </tr>
1610
- </table>
1611
- </div>
1612
-
1613
- <div class="method_details ">
1614
- <p class="signature " id="has_value-instance_method">
1615
-
1616
- - (<tt><span class='object_link'><a href="ParameterMatchers/HasValue.html" title="Mocha::ParameterMatchers::HasValue (class)">HasValue</a></span></tt>) <strong>has_value</strong>(value)
1617
-
1618
-
1619
-
1620
- </p><div class="docstring">
1621
- <div class="discussion">
1622
-
1623
- <p>Matches <tt>Hash</tt> containing <tt>value</tt>.</p>
1624
-
1625
-
1626
- </div>
1627
- </div>
1628
- <div class="tags">
1629
-
1630
- <div class="examples">
1631
- <h3>Examples:</h3>
1632
-
1633
- <h4><div class='inline'>
1634
- <p>Actual parameter contains entry with expected value.</p>
1635
- </div></h4>
1636
- <pre class="example code"><span class='id identifier rubyid_object'>object</span> <span class='op'>=</span> <span class='id identifier rubyid_mock'>mock</span><span class='lparen'>(</span><span class='rparen'>)</span>
1637
- <span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_expects'>expects</span><span class='lparen'>(</span><span class='symbol'>:method_1</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_with'>with</span><span class='lparen'>(</span><span class='id identifier rubyid_has_value'>has_value</span><span class='lparen'>(</span><span class='int'>1</span><span class='rparen'>)</span><span class='rparen'>)</span>
1638
- <span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_method_1'>method_1</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>key_1</span><span class='tstring_end'>'</span></span> <span class='op'>=&gt;</span> <span class='int'>1</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>key_2</span><span class='tstring_end'>'</span></span> <span class='op'>=&gt;</span> <span class='int'>2</span><span class='rparen'>)</span>
1639
- <span class='comment'># no error raised</span></pre>
1640
-
1641
- <h4><div class='inline'>
1642
- <p>Actual parameter does not contain entry with expected value.</p>
1643
- </div></h4>
1644
- <pre class="example code"><span class='id identifier rubyid_object'>object</span> <span class='op'>=</span> <span class='id identifier rubyid_mock'>mock</span><span class='lparen'>(</span><span class='rparen'>)</span>
1645
- <span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_expects'>expects</span><span class='lparen'>(</span><span class='symbol'>:method_1</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_with'>with</span><span class='lparen'>(</span><span class='id identifier rubyid_has_value'>has_value</span><span class='lparen'>(</span><span class='int'>1</span><span class='rparen'>)</span><span class='rparen'>)</span>
1646
- <span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_method_1'>method_1</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>key_2</span><span class='tstring_end'>'</span></span> <span class='op'>=&gt;</span> <span class='int'>2</span><span class='rparen'>)</span>
1647
- <span class='comment'># error raised, because method_1 was not called with Hash containing value: 1</span></pre>
1648
-
1649
- </div>
1650
- <h3>Parameters:</h3>
1651
- <ul class="param">
1652
-
1653
- <li>
1654
-
1655
- <span class='name'>value</span>
1656
-
1657
-
1658
- <span class='type'>(<tt><span class='object_link'><a href="../Object.html" title="Object (class)">Object</a></span></tt>)</span>
1659
-
1660
-
1661
-
1662
- &mdash;
1663
- <div class='inline'>
1664
- <p>expected value.</p>
1665
- </div>
1666
-
1667
- </li>
1668
-
1669
- </ul>
1670
-
1671
- <h3>Returns:</h3>
1672
- <ul class="return">
1673
-
1674
- <li>
1675
-
1676
-
1677
- <span class='type'>(<tt><span class='object_link'><a href="ParameterMatchers/HasValue.html" title="Mocha::ParameterMatchers::HasValue (class)">HasValue</a></span></tt>)</span>
1678
-
1679
-
1680
-
1681
- &mdash;
1682
- <div class='inline'>
1683
- <p>parameter matcher.</p>
1684
- </div>
1685
-
1686
- </li>
1687
-
1688
- </ul>
1689
-
1690
- <h3>See Also:</h3>
1691
- <ul class="see">
1692
-
1693
- <li><span class='object_link'><a href="Expectation.html#with-instance_method" title="Mocha::Expectation#with (method)">Expectation#with</a></span></li>
1694
-
1695
- </ul>
1696
-
1697
- </div><table class="source_code">
1698
- <tr>
1699
- <td>
1700
- <pre class="lines">
1701
-
1702
-
1703
- 25
1704
- 26
1705
- 27</pre>
1706
- </td>
1707
- <td>
1708
- <pre class="code"><span class="info file"># File 'lib/mocha/parameter_matchers/has_value.rb', line 25</span>
1709
-
1710
- <span class='kw'>def</span> <span class='id identifier rubyid_has_value'>has_value</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span><span class='rparen'>)</span>
1711
- <span class='const'>HasValue</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span><span class='rparen'>)</span>
1712
- <span class='kw'>end</span></pre>
1713
- </td>
1714
- </tr>
1715
- </table>
1716
- </div>
1717
-
1718
- <div class="method_details ">
1719
- <p class="signature " id="includes-instance_method">
1720
-
1721
- - (<tt><span class='object_link'><a href="ParameterMatchers/Includes.html" title="Mocha::ParameterMatchers::Includes (class)">Includes</a></span></tt>) <strong>includes</strong>(item)
1722
-
1723
-
1724
-
1725
- </p><div class="docstring">
1726
- <div class="discussion">
1727
-
1728
- <p>Matches any object that responds with <tt>true</tt> to <tt>include?(item)</tt>.</p>
1729
-
1730
-
1731
- </div>
1732
- </div>
1733
- <div class="tags">
1734
-
1735
- <div class="examples">
1736
- <h3>Examples:</h3>
1737
-
1738
- <h4><div class='inline'>
1739
- <p>Actual parameter includes item.</p>
1740
- </div></h4>
1741
- <pre class="example code"><span class='id identifier rubyid_object'>object</span> <span class='op'>=</span> <span class='id identifier rubyid_mock'>mock</span><span class='lparen'>(</span><span class='rparen'>)</span>
1742
- <span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_expects'>expects</span><span class='lparen'>(</span><span class='symbol'>:method_1</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_with'>with</span><span class='lparen'>(</span><span class='id identifier rubyid_includes'>includes</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>foo</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span><span class='rparen'>)</span>
1743
- <span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_method_1'>method_1</span><span class='lparen'>(</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>foo</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>bar</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='rparen'>)</span>
1744
- <span class='comment'># no error raised</span></pre>
1745
-
1746
- <h4><div class='inline'>
1747
- <p>Actual parameter does not include item.</p>
1748
- </div></h4>
1749
- <pre class="example code"><span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_method_1'>method_1</span><span class='lparen'>(</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>baz</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='rparen'>)</span>
1750
- <span class='comment'># error raised, because ['baz'] does not include 'foo'.</span></pre>
1751
-
1752
- </div>
1753
- <h3>Parameters:</h3>
1754
- <ul class="param">
1755
-
1756
- <li>
1757
-
1758
- <span class='name'>item</span>
1759
-
1760
-
1761
- <span class='type'>(<tt><span class='object_link'><a href="../Object.html" title="Object (class)">Object</a></span></tt>)</span>
1762
-
1763
-
1764
-
1765
- &mdash;
1766
- <div class='inline'>
1767
- <p>expected item.</p>
1768
- </div>
1769
-
1770
- </li>
1771
-
1772
- </ul>
1773
-
1774
- <h3>Returns:</h3>
1775
- <ul class="return">
1776
-
1777
- <li>
1778
-
1779
-
1780
- <span class='type'>(<tt><span class='object_link'><a href="ParameterMatchers/Includes.html" title="Mocha::ParameterMatchers::Includes (class)">Includes</a></span></tt>)</span>
1781
-
1782
-
1783
-
1784
- &mdash;
1785
- <div class='inline'>
1786
- <p>parameter matcher.</p>
1787
- </div>
1788
-
1789
- </li>
1790
-
1791
- </ul>
1792
-
1793
- <h3>See Also:</h3>
1794
- <ul class="see">
1795
-
1796
- <li><span class='object_link'><a href="Expectation.html#with-instance_method" title="Mocha::Expectation#with (method)">Expectation#with</a></span></li>
1797
-
1798
- </ul>
1799
-
1800
- </div><table class="source_code">
1801
- <tr>
1802
- <td>
1803
- <pre class="lines">
1804
-
1805
-
1806
- 23
1807
- 24
1808
- 25</pre>
1809
- </td>
1810
- <td>
1811
- <pre class="code"><span class="info file"># File 'lib/mocha/parameter_matchers/includes.rb', line 23</span>
1812
-
1813
- <span class='kw'>def</span> <span class='id identifier rubyid_includes'>includes</span><span class='lparen'>(</span><span class='id identifier rubyid_item'>item</span><span class='rparen'>)</span>
1814
- <span class='const'>Includes</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_item'>item</span><span class='rparen'>)</span>
1815
- <span class='kw'>end</span></pre>
1816
- </td>
1817
- </tr>
1818
- </table>
1819
- </div>
1820
-
1821
- <div class="method_details ">
1822
- <p class="signature " id="instance_of-instance_method">
1823
-
1824
- - (<tt><span class='object_link'><a href="ParameterMatchers/InstanceOf.html" title="Mocha::ParameterMatchers::InstanceOf (class)">InstanceOf</a></span></tt>) <strong>instance_of</strong>(klass)
1825
-
1826
-
1827
-
1828
- </p><div class="docstring">
1829
- <div class="discussion">
1830
-
1831
- <p>Matches any object that is an instance of <tt>klass</tt></p>
1832
-
1833
-
1834
- </div>
1835
- </div>
1836
- <div class="tags">
1837
-
1838
- <div class="examples">
1839
- <h3>Examples:</h3>
1840
-
1841
- <h4><div class='inline'>
1842
- <p>Actual parameter is an instance of <tt>String</tt>.</p>
1843
- </div></h4>
1844
- <pre class="example code"><span class='id identifier rubyid_object'>object</span> <span class='op'>=</span> <span class='id identifier rubyid_mock'>mock</span><span class='lparen'>(</span><span class='rparen'>)</span>
1845
- <span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_expects'>expects</span><span class='lparen'>(</span><span class='symbol'>:method_1</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_with'>with</span><span class='lparen'>(</span><span class='id identifier rubyid_instance_of'>instance_of</span><span class='lparen'>(</span><span class='const'>String</span><span class='rparen'>)</span><span class='rparen'>)</span>
1846
- <span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_method_1'>method_1</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>string</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span>
1847
- <span class='comment'># no error raised</span></pre>
1848
-
1849
- <h4><div class='inline'>
1850
- <p>Actual parameter is not an instance of <tt>String</tt>.</p>
1851
- </div></h4>
1852
- <pre class="example code"><span class='id identifier rubyid_object'>object</span> <span class='op'>=</span> <span class='id identifier rubyid_mock'>mock</span><span class='lparen'>(</span><span class='rparen'>)</span>
1853
- <span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_expects'>expects</span><span class='lparen'>(</span><span class='symbol'>:method_1</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_with'>with</span><span class='lparen'>(</span><span class='id identifier rubyid_instance_of'>instance_of</span><span class='lparen'>(</span><span class='const'>String</span><span class='rparen'>)</span><span class='rparen'>)</span>
1854
- <span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_method_1'>method_1</span><span class='lparen'>(</span><span class='int'>99</span><span class='rparen'>)</span>
1855
- <span class='comment'># error raised, because method_1 was not called with an instance of String</span></pre>
1856
-
1857
- </div>
1858
- <h3>Parameters:</h3>
1859
- <ul class="param">
1860
-
1861
- <li>
1862
-
1863
- <span class='name'>klass</span>
1864
-
1865
-
1866
- <span class='type'>(<tt><span class='object_link'><a href="../Class.html" title="Class (class)">Class</a></span></tt>)</span>
1867
-
1868
-
1869
-
1870
- &mdash;
1871
- <div class='inline'>
1872
- <p>expected class.</p>
1873
- </div>
1874
-
1875
- </li>
1876
-
1877
- </ul>
1878
-
1879
- <h3>Returns:</h3>
1880
- <ul class="return">
1881
-
1882
- <li>
1883
-
1884
-
1885
- <span class='type'>(<tt><span class='object_link'><a href="ParameterMatchers/InstanceOf.html" title="Mocha::ParameterMatchers::InstanceOf (class)">InstanceOf</a></span></tt>)</span>
1886
-
1887
-
1888
-
1889
- &mdash;
1890
- <div class='inline'>
1891
- <p>parameter matcher.</p>
1892
- </div>
1893
-
1894
- </li>
1895
-
1896
- </ul>
1897
-
1898
- <h3>See Also:</h3>
1899
- <ul class="see">
1900
-
1901
- <li><span class='object_link'><a href="Expectation.html#with-instance_method" title="Mocha::Expectation#with (method)">Expectation#with</a></span></li>
1902
-
1903
- <li>Kernel#instance_of?</li>
1904
-
1905
- </ul>
1906
-
1907
- </div><table class="source_code">
1908
- <tr>
1909
- <td>
1910
- <pre class="lines">
1911
-
1912
-
1913
- 26
1914
- 27
1915
- 28</pre>
1916
- </td>
1917
- <td>
1918
- <pre class="code"><span class="info file"># File 'lib/mocha/parameter_matchers/instance_of.rb', line 26</span>
1919
-
1920
- <span class='kw'>def</span> <span class='id identifier rubyid_instance_of'>instance_of</span><span class='lparen'>(</span><span class='id identifier rubyid_klass'>klass</span><span class='rparen'>)</span>
1921
- <span class='const'>InstanceOf</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_klass'>klass</span><span class='rparen'>)</span>
1922
- <span class='kw'>end</span></pre>
1923
- </td>
1924
- </tr>
1925
- </table>
1926
- </div>
1927
-
1928
- <div class="method_details ">
1929
- <p class="signature " id="is_a-instance_method">
1930
-
1931
- - (<tt><span class='object_link'><a href="ParameterMatchers/IsA.html" title="Mocha::ParameterMatchers::IsA (class)">IsA</a></span></tt>) <strong>is_a</strong>(klass)
1932
-
1933
-
1934
-
1935
- </p><div class="docstring">
1936
- <div class="discussion">
1937
-
1938
- <p>Matches any object that is a <tt>klass</tt>.</p>
1939
-
1940
-
1941
- </div>
1942
- </div>
1943
- <div class="tags">
1944
-
1945
- <div class="examples">
1946
- <h3>Examples:</h3>
1947
-
1948
- <h4><div class='inline'>
1949
- <p>Actual parameter is a <tt>Integer</tt>.</p>
1950
- </div></h4>
1951
- <pre class="example code"><span class='id identifier rubyid_object'>object</span> <span class='op'>=</span> <span class='id identifier rubyid_mock'>mock</span><span class='lparen'>(</span><span class='rparen'>)</span>
1952
- <span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_expects'>expects</span><span class='lparen'>(</span><span class='symbol'>:method_1</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_with'>with</span><span class='lparen'>(</span><span class='id identifier rubyid_is_a'>is_a</span><span class='lparen'>(</span><span class='const'>Integer</span><span class='rparen'>)</span><span class='rparen'>)</span>
1953
- <span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_method_1'>method_1</span><span class='lparen'>(</span><span class='int'>99</span><span class='rparen'>)</span>
1954
- <span class='comment'># no error raised</span></pre>
1955
-
1956
- <h4><div class='inline'>
1957
- <p>Actual parameter is not a <tt>Integer</tt>.</p>
1958
- </div></h4>
1959
- <pre class="example code"><span class='id identifier rubyid_object'>object</span> <span class='op'>=</span> <span class='id identifier rubyid_mock'>mock</span><span class='lparen'>(</span><span class='rparen'>)</span>
1960
- <span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_expects'>expects</span><span class='lparen'>(</span><span class='symbol'>:method_1</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_with'>with</span><span class='lparen'>(</span><span class='id identifier rubyid_is_a'>is_a</span><span class='lparen'>(</span><span class='const'>Integer</span><span class='rparen'>)</span><span class='rparen'>)</span>
1961
- <span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_method_1'>method_1</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>string</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span>
1962
- <span class='comment'># error raised, because method_1 was not called with an Integer</span></pre>
1963
-
1964
- </div>
1965
- <h3>Parameters:</h3>
1966
- <ul class="param">
1967
-
1968
- <li>
1969
-
1970
- <span class='name'>klass</span>
1971
-
1972
-
1973
- <span class='type'>(<tt><span class='object_link'><a href="../Class.html" title="Class (class)">Class</a></span></tt>)</span>
1974
-
1975
-
1976
-
1977
- &mdash;
1978
- <div class='inline'>
1979
- <p>expected class.</p>
1980
- </div>
1981
-
1982
- </li>
1983
-
1984
- </ul>
1985
-
1986
- <h3>Returns:</h3>
1987
- <ul class="return">
1988
-
1989
- <li>
1990
-
1991
-
1992
- <span class='type'>(<tt><span class='object_link'><a href="ParameterMatchers/IsA.html" title="Mocha::ParameterMatchers::IsA (class)">IsA</a></span></tt>)</span>
1993
-
1994
-
1995
-
1996
- &mdash;
1997
- <div class='inline'>
1998
- <p>parameter matcher.</p>
1999
- </div>
2000
-
2001
- </li>
2002
-
2003
- </ul>
2004
-
2005
- <h3>See Also:</h3>
2006
- <ul class="see">
2007
-
2008
- <li><span class='object_link'><a href="Expectation.html#with-instance_method" title="Mocha::Expectation#with (method)">Expectation#with</a></span></li>
2009
-
2010
- <li>Kernel#is_a?</li>
2011
-
2012
- </ul>
2013
-
2014
- </div><table class="source_code">
2015
- <tr>
2016
- <td>
2017
- <pre class="lines">
2018
-
2019
-
2020
- 26
2021
- 27
2022
- 28</pre>
2023
- </td>
2024
- <td>
2025
- <pre class="code"><span class="info file"># File 'lib/mocha/parameter_matchers/is_a.rb', line 26</span>
2026
-
2027
- <span class='kw'>def</span> <span class='id identifier rubyid_is_a'>is_a</span><span class='lparen'>(</span><span class='id identifier rubyid_klass'>klass</span><span class='rparen'>)</span>
2028
- <span class='const'>IsA</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_klass'>klass</span><span class='rparen'>)</span>
2029
- <span class='kw'>end</span></pre>
2030
- </td>
2031
- </tr>
2032
- </table>
2033
- </div>
2034
-
2035
- <div class="method_details ">
2036
- <p class="signature " id="kind_of-instance_method">
2037
-
2038
- - (<tt><span class='object_link'><a href="ParameterMatchers/KindOf.html" title="Mocha::ParameterMatchers::KindOf (class)">KindOf</a></span></tt>) <strong>kind_of</strong>(klass)
2039
-
2040
-
2041
-
2042
- </p><div class="docstring">
2043
- <div class="discussion">
2044
-
2045
- <p>Matches any <tt>Object</tt> that is a kind of <tt>klass</tt>.</p>
2046
-
2047
-
2048
- </div>
2049
- </div>
2050
- <div class="tags">
2051
-
2052
- <div class="examples">
2053
- <h3>Examples:</h3>
2054
-
2055
- <h4><div class='inline'>
2056
- <p>Actual parameter is a kind of <tt>Integer</tt>.</p>
2057
- </div></h4>
2058
- <pre class="example code"><span class='id identifier rubyid_object'>object</span> <span class='op'>=</span> <span class='id identifier rubyid_mock'>mock</span><span class='lparen'>(</span><span class='rparen'>)</span>
2059
- <span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_expects'>expects</span><span class='lparen'>(</span><span class='symbol'>:method_1</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_with'>with</span><span class='lparen'>(</span><span class='id identifier rubyid_kind_of'>kind_of</span><span class='lparen'>(</span><span class='const'>Integer</span><span class='rparen'>)</span><span class='rparen'>)</span>
2060
- <span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_method_1'>method_1</span><span class='lparen'>(</span><span class='int'>99</span><span class='rparen'>)</span>
2061
- <span class='comment'># no error raised</span></pre>
2062
-
2063
- <h4><div class='inline'>
2064
- <p>Actual parameter is not a kind of <tt>Integer</tt>.</p>
2065
- </div></h4>
2066
- <pre class="example code"><span class='id identifier rubyid_object'>object</span> <span class='op'>=</span> <span class='id identifier rubyid_mock'>mock</span><span class='lparen'>(</span><span class='rparen'>)</span>
2067
- <span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_expects'>expects</span><span class='lparen'>(</span><span class='symbol'>:method_1</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_with'>with</span><span class='lparen'>(</span><span class='id identifier rubyid_kind_of'>kind_of</span><span class='lparen'>(</span><span class='const'>Integer</span><span class='rparen'>)</span><span class='rparen'>)</span>
2068
- <span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_method_1'>method_1</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>string</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span>
2069
- <span class='comment'># error raised, because method_1 was not called with a kind of Integer</span></pre>
2070
-
2071
- </div>
2072
- <h3>Parameters:</h3>
2073
- <ul class="param">
2074
-
2075
- <li>
2076
-
2077
- <span class='name'>klass</span>
2078
-
2079
-
2080
- <span class='type'>(<tt><span class='object_link'><a href="../Class.html" title="Class (class)">Class</a></span></tt>)</span>
2081
-
2082
-
2083
-
2084
- &mdash;
2085
- <div class='inline'>
2086
- <p>expected class.</p>
2087
- </div>
2088
-
2089
- </li>
2090
-
2091
- </ul>
2092
-
2093
- <h3>Returns:</h3>
2094
- <ul class="return">
2095
-
2096
- <li>
2097
-
2098
-
2099
- <span class='type'>(<tt><span class='object_link'><a href="ParameterMatchers/KindOf.html" title="Mocha::ParameterMatchers::KindOf (class)">KindOf</a></span></tt>)</span>
2100
-
2101
-
2102
-
2103
- &mdash;
2104
- <div class='inline'>
2105
- <p>parameter matcher.</p>
2106
- </div>
2107
-
2108
- </li>
2109
-
2110
- </ul>
2111
-
2112
- <h3>See Also:</h3>
2113
- <ul class="see">
2114
-
2115
- <li><span class='object_link'><a href="Expectation.html#with-instance_method" title="Mocha::Expectation#with (method)">Expectation#with</a></span></li>
2116
-
2117
- <li>Kernel#kind_of?</li>
2118
-
2119
- </ul>
2120
-
2121
- </div><table class="source_code">
2122
- <tr>
2123
- <td>
2124
- <pre class="lines">
2125
-
2126
-
2127
- 26
2128
- 27
2129
- 28</pre>
2130
- </td>
2131
- <td>
2132
- <pre class="code"><span class="info file"># File 'lib/mocha/parameter_matchers/kind_of.rb', line 26</span>
2133
-
2134
- <span class='kw'>def</span> <span class='id identifier rubyid_kind_of'>kind_of</span><span class='lparen'>(</span><span class='id identifier rubyid_klass'>klass</span><span class='rparen'>)</span>
2135
- <span class='const'>KindOf</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_klass'>klass</span><span class='rparen'>)</span>
2136
- <span class='kw'>end</span></pre>
2137
- </td>
2138
- </tr>
2139
- </table>
2140
- </div>
2141
-
2142
- <div class="method_details ">
2143
- <p class="signature " id="Not-instance_method">
2144
-
2145
- - (<tt><span class='object_link'><a href="ParameterMatchers/Not.html" title="Mocha::ParameterMatchers::Not (class)">Not</a></span></tt>) <strong>Not</strong>(matcher)
2146
-
2147
-
2148
-
2149
- </p><div class="docstring">
2150
- <div class="discussion">
2151
-
2152
- <p>Matches if <tt>matcher</tt> does <b>not</b> match.</p>
2153
-
2154
-
2155
- </div>
2156
- </div>
2157
- <div class="tags">
2158
-
2159
- <div class="examples">
2160
- <h3>Examples:</h3>
2161
-
2162
- <h4><div class='inline'>
2163
- <p>Actual parameter does not include the value <tt>1</tt>.</p>
2164
- </div></h4>
2165
- <pre class="example code"><span class='id identifier rubyid_object'>object</span> <span class='op'>=</span> <span class='id identifier rubyid_mock'>mock</span><span class='lparen'>(</span><span class='rparen'>)</span>
2166
- <span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_expects'>expects</span><span class='lparen'>(</span><span class='symbol'>:method_1</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_with'>with</span><span class='lparen'>(</span><span class='const'>Not</span><span class='lparen'>(</span><span class='id identifier rubyid_includes'>includes</span><span class='lparen'>(</span><span class='int'>1</span><span class='rparen'>)</span><span class='rparen'>)</span><span class='rparen'>)</span>
2167
- <span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_method_1'>method_1</span><span class='lparen'>(</span><span class='lbracket'>[</span><span class='int'>0</span><span class='comma'>,</span> <span class='int'>2</span><span class='comma'>,</span> <span class='int'>3</span><span class='rbracket'>]</span><span class='rparen'>)</span>
2168
- <span class='comment'># no error raised</span></pre>
2169
-
2170
- <h4><div class='inline'>
2171
- <p>Actual parameter does include the value <tt>1</tt>.</p>
2172
- </div></h4>
2173
- <pre class="example code"><span class='id identifier rubyid_object'>object</span> <span class='op'>=</span> <span class='id identifier rubyid_mock'>mock</span><span class='lparen'>(</span><span class='rparen'>)</span>
2174
- <span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_expects'>expects</span><span class='lparen'>(</span><span class='symbol'>:method_1</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_with'>with</span><span class='lparen'>(</span><span class='const'>Not</span><span class='lparen'>(</span><span class='id identifier rubyid_includes'>includes</span><span class='lparen'>(</span><span class='int'>1</span><span class='rparen'>)</span><span class='rparen'>)</span><span class='rparen'>)</span>
2175
- <span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_method_1'>method_1</span><span class='lparen'>(</span><span class='lbracket'>[</span><span class='int'>0</span><span class='comma'>,</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='rbracket'>]</span><span class='rparen'>)</span>
2176
- <span class='comment'># error raised, because method_1 was not called with object not including 1</span></pre>
2177
-
2178
- </div>
2179
- <h3>Parameters:</h3>
2180
- <ul class="param">
2181
-
2182
- <li>
2183
-
2184
- <span class='name'>matcher</span>
2185
-
2186
-
2187
- <span class='type'>(<tt><span class='object_link'><a href="ParameterMatchers/Base.html" title="Mocha::ParameterMatchers::Base (class)">Base</a></span></tt>)</span>
2188
-
2189
-
2190
-
2191
- &mdash;
2192
- <div class='inline'>
2193
- <p>matcher whose logic to invert.</p>
2194
- </div>
2195
-
2196
- </li>
2197
-
2198
- </ul>
2199
-
2200
- <h3>Returns:</h3>
2201
- <ul class="return">
2202
-
2203
- <li>
2204
-
2205
-
2206
- <span class='type'>(<tt><span class='object_link'><a href="ParameterMatchers/Not.html" title="Mocha::ParameterMatchers::Not (class)">Not</a></span></tt>)</span>
2207
-
2208
-
2209
-
2210
- &mdash;
2211
- <div class='inline'>
2212
- <p>parameter matcher.</p>
2213
- </div>
2214
-
2215
- </li>
2216
-
2217
- </ul>
2218
-
2219
- <h3>See Also:</h3>
2220
- <ul class="see">
2221
-
2222
- <li><span class='object_link'><a href="Expectation.html#with-instance_method" title="Mocha::Expectation#with (method)">Expectation#with</a></span></li>
2223
-
2224
- </ul>
2225
-
2226
- </div><table class="source_code">
2227
- <tr>
2228
- <td>
2229
- <pre class="lines">
2230
-
2231
-
2232
- 25
2233
- 26
2234
- 27</pre>
2235
- </td>
2236
- <td>
2237
- <pre class="code"><span class="info file"># File 'lib/mocha/parameter_matchers/not.rb', line 25</span>
2238
-
2239
- <span class='kw'>def</span> <span class='const'>Not</span><span class='lparen'>(</span><span class='id identifier rubyid_matcher'>matcher</span><span class='rparen'>)</span>
2240
- <span class='const'>Not</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_matcher'>matcher</span><span class='rparen'>)</span>
2241
- <span class='kw'>end</span></pre>
2242
- </td>
2243
- </tr>
2244
- </table>
2245
- </div>
2246
-
2247
- <div class="method_details ">
2248
- <p class="signature " id="optionally-instance_method">
2249
-
2250
- - (<tt><span class='object_link'><a href="ParameterMatchers/Optionally.html" title="Mocha::ParameterMatchers::Optionally (class)">Optionally</a></span></tt>) <strong>optionally</strong>(*matchers)
2251
-
2252
-
2253
-
2254
- </p><div class="docstring">
2255
- <div class="discussion">
2256
-
2257
- <p>Matches optional parameters if available.</p>
2258
-
2259
-
2260
- </div>
2261
- </div>
2262
- <div class="tags">
2263
-
2264
- <div class="examples">
2265
- <h3>Examples:</h3>
2266
-
2267
- <h4><div class='inline'>
2268
- <p>Only the two required parameters are supplied and they both match their
2269
- expected value.</p>
2270
- </div></h4>
2271
- <pre class="example code"><span class='id identifier rubyid_object'>object</span> <span class='op'>=</span> <span class='id identifier rubyid_mock'>mock</span><span class='lparen'>(</span><span class='rparen'>)</span>
2272
- <span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_expects'>expects</span><span class='lparen'>(</span><span class='symbol'>:method_1</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_with'>with</span><span class='lparen'>(</span><span class='int'>1</span><span class='comma'>,</span> <span class='int'>2</span><span class='comma'>,</span> <span class='id identifier rubyid_optionally'>optionally</span><span class='lparen'>(</span><span class='int'>3</span><span class='comma'>,</span> <span class='int'>4</span><span class='rparen'>)</span><span class='rparen'>)</span>
2273
- <span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_method_1'>method_1</span><span class='lparen'>(</span><span class='int'>1</span><span class='comma'>,</span> <span class='int'>2</span><span class='rparen'>)</span>
2274
- <span class='comment'># no error raised</span></pre>
2275
-
2276
- <h4><div class='inline'>
2277
- <p>Both required parameters and one of the optional parameters are supplied
2278
- and they all match their expected value.</p>
2279
- </div></h4>
2280
- <pre class="example code"><span class='id identifier rubyid_object'>object</span> <span class='op'>=</span> <span class='id identifier rubyid_mock'>mock</span><span class='lparen'>(</span><span class='rparen'>)</span>
2281
- <span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_expects'>expects</span><span class='lparen'>(</span><span class='symbol'>:method_1</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_with'>with</span><span class='lparen'>(</span><span class='int'>1</span><span class='comma'>,</span> <span class='int'>2</span><span class='comma'>,</span> <span class='id identifier rubyid_optionally'>optionally</span><span class='lparen'>(</span><span class='int'>3</span><span class='comma'>,</span> <span class='int'>4</span><span class='rparen'>)</span><span class='rparen'>)</span>
2282
- <span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_method_1'>method_1</span><span class='lparen'>(</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='rparen'>)</span>
2283
- <span class='comment'># no error raised</span></pre>
2284
-
2285
- <h4><div class='inline'>
2286
- <p>Both required parameters and both of the optional parameters are supplied
2287
- and they all match their expected value.</p>
2288
- </div></h4>
2289
- <pre class="example code"><span class='id identifier rubyid_object'>object</span> <span class='op'>=</span> <span class='id identifier rubyid_mock'>mock</span><span class='lparen'>(</span><span class='rparen'>)</span>
2290
- <span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_expects'>expects</span><span class='lparen'>(</span><span class='symbol'>:method_1</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_with'>with</span><span class='lparen'>(</span><span class='int'>1</span><span class='comma'>,</span> <span class='int'>2</span><span class='comma'>,</span> <span class='id identifier rubyid_optionally'>optionally</span><span class='lparen'>(</span><span class='int'>3</span><span class='comma'>,</span> <span class='int'>4</span><span class='rparen'>)</span><span class='rparen'>)</span>
2291
- <span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_method_1'>method_1</span><span class='lparen'>(</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='int'>4</span><span class='rparen'>)</span>
2292
- <span class='comment'># no error raised</span></pre>
2293
-
2294
- <h4><div class='inline'>
2295
- <p>One of the actual optional parameters does not match the expected value.</p>
2296
- </div></h4>
2297
- <pre class="example code"><span class='id identifier rubyid_object'>object</span> <span class='op'>=</span> <span class='id identifier rubyid_mock'>mock</span><span class='lparen'>(</span><span class='rparen'>)</span>
2298
- <span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_expects'>expects</span><span class='lparen'>(</span><span class='symbol'>:method_1</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_with'>with</span><span class='lparen'>(</span><span class='int'>1</span><span class='comma'>,</span> <span class='int'>2</span><span class='comma'>,</span> <span class='id identifier rubyid_optionally'>optionally</span><span class='lparen'>(</span><span class='int'>3</span><span class='comma'>,</span> <span class='int'>4</span><span class='rparen'>)</span><span class='rparen'>)</span>
2299
- <span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_method_1'>method_1</span><span class='lparen'>(</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='int'>5</span><span class='rparen'>)</span>
2300
- <span class='comment'># error raised, because optional parameters did not match</span></pre>
2301
-
2302
- </div>
2303
- <h3>Parameters:</h3>
2304
- <ul class="param">
2305
-
2306
- <li>
2307
-
2308
- <span class='name'>matchers</span>
2309
-
2310
-
2311
- <span class='type'>(<tt>*Array&lt;<span class='object_link'><a href="ParameterMatchers/Base.html" title="Mocha::ParameterMatchers::Base (class)">Base</a></span>&gt;</tt>)</span>
2312
-
2313
-
2314
-
2315
- &mdash;
2316
- <div class='inline'>
2317
- <p>matchers for optional parameters.</p>
2318
- </div>
2319
-
2320
- </li>
2321
-
2322
- </ul>
2323
-
2324
- <h3>Returns:</h3>
2325
- <ul class="return">
2326
-
2327
- <li>
2328
-
2329
-
2330
- <span class='type'>(<tt><span class='object_link'><a href="ParameterMatchers/Optionally.html" title="Mocha::ParameterMatchers::Optionally (class)">Optionally</a></span></tt>)</span>
2331
-
2332
-
2333
-
2334
- &mdash;
2335
- <div class='inline'>
2336
- <p>parameter matcher.</p>
2337
- </div>
2338
-
2339
- </li>
2340
-
2341
- </ul>
2342
-
2343
- <h3>See Also:</h3>
2344
- <ul class="see">
2345
-
2346
- <li><span class='object_link'><a href="Expectation.html#with-instance_method" title="Mocha::Expectation#with (method)">Expectation#with</a></span></li>
2347
-
2348
- </ul>
2349
-
2350
- </div><table class="source_code">
2351
- <tr>
2352
- <td>
2353
- <pre class="lines">
2354
-
2355
-
2356
- 35
2357
- 36
2358
- 37</pre>
2359
- </td>
2360
- <td>
2361
- <pre class="code"><span class="info file"># File 'lib/mocha/parameter_matchers/optionally.rb', line 35</span>
2362
-
2363
- <span class='kw'>def</span> <span class='id identifier rubyid_optionally'>optionally</span><span class='lparen'>(</span><span class='op'>*</span><span class='id identifier rubyid_matchers'>matchers</span><span class='rparen'>)</span>
2364
- <span class='const'>Optionally</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='op'>*</span><span class='id identifier rubyid_matchers'>matchers</span><span class='rparen'>)</span>
2365
- <span class='kw'>end</span></pre>
2366
- </td>
2367
- </tr>
2368
- </table>
2369
- </div>
2370
-
2371
- <div class="method_details ">
2372
- <p class="signature " id="regexp_matches-instance_method">
2373
-
2374
- - (<tt><span class='object_link'><a href="ParameterMatchers/RegexpMatches.html" title="Mocha::ParameterMatchers::RegexpMatches (class)">RegexpMatches</a></span></tt>) <strong>regexp_matches</strong>(regexp)
2375
-
2376
-
2377
-
2378
- </p><div class="docstring">
2379
- <div class="discussion">
2380
-
2381
- <p>Matches any object that matches <tt>regexp</tt>.</p>
2382
-
2383
-
2384
- </div>
2385
- </div>
2386
- <div class="tags">
2387
-
2388
- <div class="examples">
2389
- <h3>Examples:</h3>
2390
-
2391
- <h4><div class='inline'>
2392
- <p>Actual parameter is matched by specified regular expression.</p>
2393
- </div></h4>
2394
- <pre class="example code"><span class='id identifier rubyid_object'>object</span> <span class='op'>=</span> <span class='id identifier rubyid_mock'>mock</span><span class='lparen'>(</span><span class='rparen'>)</span>
2395
- <span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_expects'>expects</span><span class='lparen'>(</span><span class='symbol'>:method_1</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_with'>with</span><span class='lparen'>(</span><span class='id identifier rubyid_regexp_matches'>regexp_matches</span><span class='lparen'>(</span><span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>e</span><span class='regexp_end'>/</span></span><span class='rparen'>)</span><span class='rparen'>)</span>
2396
- <span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_method_1'>method_1</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>hello</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span>
2397
- <span class='comment'># no error raised</span></pre>
2398
-
2399
- <h4><div class='inline'>
2400
- <p>Actual parameter is not matched by specified regular expression.</p>
2401
- </div></h4>
2402
- <pre class="example code"><span class='id identifier rubyid_object'>object</span> <span class='op'>=</span> <span class='id identifier rubyid_mock'>mock</span><span class='lparen'>(</span><span class='rparen'>)</span>
2403
- <span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_expects'>expects</span><span class='lparen'>(</span><span class='symbol'>:method_1</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_with'>with</span><span class='lparen'>(</span><span class='id identifier rubyid_regexp_matches'>regexp_matches</span><span class='lparen'>(</span><span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>a</span><span class='regexp_end'>/</span></span><span class='rparen'>)</span><span class='rparen'>)</span>
2404
- <span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_method_1'>method_1</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>hello</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span>
2405
- <span class='comment'># error raised, because method_1 was not called with a parameter that matched the
2406
- </span><span class='comment'># regular expression</span></pre>
2407
-
2408
- </div>
2409
- <h3>Parameters:</h3>
2410
- <ul class="param">
2411
-
2412
- <li>
2413
-
2414
- <span class='name'>regexp</span>
2415
-
2416
-
2417
- <span class='type'>(<tt>Regexp</tt>)</span>
2418
-
2419
-
2420
-
2421
- &mdash;
2422
- <div class='inline'>
2423
- <p>regular expression to match.</p>
2424
- </div>
2425
-
2426
- </li>
2427
-
2428
- </ul>
2429
-
2430
- <h3>Returns:</h3>
2431
- <ul class="return">
2432
-
2433
- <li>
2434
-
2435
-
2436
- <span class='type'>(<tt><span class='object_link'><a href="ParameterMatchers/RegexpMatches.html" title="Mocha::ParameterMatchers::RegexpMatches (class)">RegexpMatches</a></span></tt>)</span>
2437
-
2438
-
2439
-
2440
- &mdash;
2441
- <div class='inline'>
2442
- <p>parameter matcher.</p>
2443
- </div>
2444
-
2445
- </li>
2446
-
2447
- </ul>
2448
-
2449
- <h3>See Also:</h3>
2450
- <ul class="see">
2451
-
2452
- <li><span class='object_link'><a href="Expectation.html#with-instance_method" title="Mocha::Expectation#with (method)">Expectation#with</a></span></li>
2453
-
2454
- </ul>
2455
-
2456
- </div><table class="source_code">
2457
- <tr>
2458
- <td>
2459
- <pre class="lines">
2460
-
2461
-
2462
- 26
2463
- 27
2464
- 28</pre>
2465
- </td>
2466
- <td>
2467
- <pre class="code"><span class="info file"># File 'lib/mocha/parameter_matchers/regexp_matches.rb', line 26</span>
2468
-
2469
- <span class='kw'>def</span> <span class='id identifier rubyid_regexp_matches'>regexp_matches</span><span class='lparen'>(</span><span class='id identifier rubyid_regexp'>regexp</span><span class='rparen'>)</span>
2470
- <span class='const'>RegexpMatches</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_regexp'>regexp</span><span class='rparen'>)</span>
2471
- <span class='kw'>end</span></pre>
2472
- </td>
2473
- </tr>
2474
- </table>
2475
- </div>
2476
-
2477
- <div class="method_details ">
2478
- <p class="signature " id="responds_with-instance_method">
2479
-
2480
- - (<tt><span class='object_link'><a href="ParameterMatchers/RespondsWith.html" title="Mocha::ParameterMatchers::RespondsWith (class)">RespondsWith</a></span></tt>) <strong>responds_with</strong>(message, result)
2481
-
2482
-
2483
-
2484
- </p><div class="docstring">
2485
- <div class="discussion">
2486
-
2487
- <p>Matches any object that responds to <tt>message</tt> with <tt>result</tt>.
2488
- To put it another way, it tests the quack, not the duck.</p>
2489
-
2490
-
2491
- </div>
2492
- </div>
2493
- <div class="tags">
2494
-
2495
- <div class="examples">
2496
- <h3>Examples:</h3>
2497
-
2498
- <h4><div class='inline'>
2499
- <p>Actual parameter responds with "FOO" when :upcase is invoked.</p>
2500
- </div></h4>
2501
- <pre class="example code"><span class='id identifier rubyid_object'>object</span> <span class='op'>=</span> <span class='id identifier rubyid_mock'>mock</span><span class='lparen'>(</span><span class='rparen'>)</span>
2502
- <span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_expects'>expects</span><span class='lparen'>(</span><span class='symbol'>:method_1</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_with'>with</span><span class='lparen'>(</span><span class='id identifier rubyid_responds_with'>responds_with</span><span class='lparen'>(</span><span class='symbol'>:upcase</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>FOO</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span><span class='rparen'>)</span>
2503
- <span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_method_1'>method_1</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>foo</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
2504
- <span class='comment'># no error raised, because &quot;foo&quot;.upcase == &quot;FOO&quot;</span></pre>
2505
-
2506
- <h4><div class='inline'>
2507
- <p>Actual parameter does not respond with "FOO" when :upcase is invoked.</p>
2508
- </div></h4>
2509
- <pre class="example code"><span class='id identifier rubyid_object'>object</span> <span class='op'>=</span> <span class='id identifier rubyid_mock'>mock</span><span class='lparen'>(</span><span class='rparen'>)</span>
2510
- <span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_expects'>expects</span><span class='lparen'>(</span><span class='symbol'>:method_1</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_with'>with</span><span class='lparen'>(</span><span class='id identifier rubyid_responds_with'>responds_with</span><span class='lparen'>(</span><span class='symbol'>:upcase</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>BAR</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span><span class='rparen'>)</span>
2511
- <span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_method_1'>method_1</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>foo</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
2512
- <span class='comment'># error raised, because &quot;foo&quot;.upcase != &quot;BAR&quot;</span></pre>
2513
-
2514
- </div>
2515
- <h3>Parameters:</h3>
2516
- <ul class="param">
2517
-
2518
- <li>
2519
-
2520
- <span class='name'>message</span>
2521
-
2522
-
2523
- <span class='type'>(<tt>Symbol</tt>)</span>
2524
-
2525
-
2526
-
2527
- &mdash;
2528
- <div class='inline'>
2529
- <p>method to invoke.</p>
2530
- </div>
2531
-
2532
- </li>
2533
-
2534
- <li>
2535
-
2536
- <span class='name'>result</span>
2537
-
2538
-
2539
- <span class='type'>(<tt><span class='object_link'><a href="../Object.html" title="Object (class)">Object</a></span></tt>)</span>
2540
-
2541
-
2542
-
2543
- &mdash;
2544
- <div class='inline'>
2545
- <p>expected result of sending <tt>message</tt>.</p>
2546
- </div>
2547
-
2548
- </li>
2549
-
2550
- </ul>
2551
-
2552
- <h3>Returns:</h3>
2553
- <ul class="return">
2554
-
2555
- <li>
2556
-
2557
-
2558
- <span class='type'>(<tt><span class='object_link'><a href="ParameterMatchers/RespondsWith.html" title="Mocha::ParameterMatchers::RespondsWith (class)">RespondsWith</a></span></tt>)</span>
2559
-
2560
-
2561
-
2562
- &mdash;
2563
- <div class='inline'>
2564
- <p>parameter matcher.</p>
2565
- </div>
2566
-
2567
- </li>
2568
-
2569
- </ul>
2570
-
2571
- <h3>See Also:</h3>
2572
- <ul class="see">
2573
-
2574
- <li><span class='object_link'><a href="Expectation.html#with-instance_method" title="Mocha::Expectation#with (method)">Expectation#with</a></span></li>
2575
-
2576
- </ul>
2577
-
2578
- </div><table class="source_code">
2579
- <tr>
2580
- <td>
2581
- <pre class="lines">
2582
-
2583
-
2584
- 27
2585
- 28
2586
- 29</pre>
2587
- </td>
2588
- <td>
2589
- <pre class="code"><span class="info file"># File 'lib/mocha/parameter_matchers/responds_with.rb', line 27</span>
2590
-
2591
- <span class='kw'>def</span> <span class='id identifier rubyid_responds_with'>responds_with</span><span class='lparen'>(</span><span class='id identifier rubyid_message'>message</span><span class='comma'>,</span> <span class='id identifier rubyid_result'>result</span><span class='rparen'>)</span>
2592
- <span class='const'>RespondsWith</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_message'>message</span><span class='comma'>,</span> <span class='id identifier rubyid_result'>result</span><span class='rparen'>)</span>
2593
- <span class='kw'>end</span></pre>
2594
- </td>
2595
- </tr>
2596
- </table>
2597
- </div>
2598
-
2599
- <div class="method_details ">
2600
- <p class="signature " id="yaml_equivalent-instance_method">
2601
-
2602
- - (<tt><span class='object_link'><a href="ParameterMatchers/YamlEquivalent.html" title="Mocha::ParameterMatchers::YamlEquivalent (class)">YamlEquivalent</a></span></tt>) <strong>yaml_equivalent</strong>(object)
2603
-
2604
-
2605
-
2606
- </p><div class="docstring">
2607
- <div class="discussion">
2608
-
2609
- <p>Matches any YAML that represents the specified <tt>object</tt></p>
2610
-
2611
-
2612
- </div>
2613
- </div>
2614
- <div class="tags">
2615
-
2616
- <div class="examples">
2617
- <h3>Examples:</h3>
2618
-
2619
- <h4><div class='inline'>
2620
- <p>Actual parameter is YAML equivalent of specified <tt>object</tt>.</p>
2621
- </div></h4>
2622
- <pre class="example code"><span class='id identifier rubyid_object'>object</span> <span class='op'>=</span> <span class='id identifier rubyid_mock'>mock</span><span class='lparen'>(</span><span class='rparen'>)</span>
2623
- <span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_expects'>expects</span><span class='lparen'>(</span><span class='symbol'>:method_1</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_with'>with</span><span class='lparen'>(</span><span class='id identifier rubyid_yaml_equivalent'>yaml_equivalent</span><span class='lparen'>(</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='rparen'>)</span><span class='rparen'>)</span>
2624
- <span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_method_1'>method_1</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>--- \n- 1\n- 2\n- 3\n</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
2625
- <span class='comment'># no error raised</span></pre>
2626
-
2627
- <h4><div class='inline'>
2628
- <p>Actual parameter is not YAML equivalent of specified <tt>object</tt>.</p>
2629
- </div></h4>
2630
- <pre class="example code"><span class='id identifier rubyid_object'>object</span> <span class='op'>=</span> <span class='id identifier rubyid_mock'>mock</span><span class='lparen'>(</span><span class='rparen'>)</span>
2631
- <span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_expects'>expects</span><span class='lparen'>(</span><span class='symbol'>:method_1</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_with'>with</span><span class='lparen'>(</span><span class='id identifier rubyid_yaml_equivalent'>yaml_equivalent</span><span class='lparen'>(</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='rparen'>)</span><span class='rparen'>)</span>
2632
- <span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_method_1'>method_1</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>--- \n- 1\n- 2\n</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
2633
- <span class='comment'># error raised, because method_1 was not called with YAML representing the specified Array</span></pre>
2634
-
2635
- </div>
2636
- <h3>Parameters:</h3>
2637
- <ul class="param">
2638
-
2639
- <li>
2640
-
2641
- <span class='name'>object</span>
2642
-
2643
-
2644
- <span class='type'>(<tt><span class='object_link'><a href="../Object.html" title="Object (class)">Object</a></span></tt>)</span>
2645
-
2646
-
2647
-
2648
- &mdash;
2649
- <div class='inline'>
2650
- <p>object whose YAML to compare.</p>
2651
- </div>
2652
-
2653
- </li>
2654
-
2655
- </ul>
2656
-
2657
- <h3>Returns:</h3>
2658
- <ul class="return">
2659
-
2660
- <li>
2661
-
2662
-
2663
- <span class='type'>(<tt><span class='object_link'><a href="ParameterMatchers/YamlEquivalent.html" title="Mocha::ParameterMatchers::YamlEquivalent (class)">YamlEquivalent</a></span></tt>)</span>
2664
-
2665
-
2666
-
2667
- &mdash;
2668
- <div class='inline'>
2669
- <p>parameter matcher.</p>
2670
- </div>
2671
-
2672
- </li>
2673
-
2674
- </ul>
2675
-
2676
- <h3>See Also:</h3>
2677
- <ul class="see">
2678
-
2679
- <li><span class='object_link'><a href="Expectation.html#with-instance_method" title="Mocha::Expectation#with (method)">Expectation#with</a></span></li>
2680
-
2681
- </ul>
2682
-
2683
- </div><table class="source_code">
2684
- <tr>
2685
- <td>
2686
- <pre class="lines">
2687
-
2688
-
2689
- 26
2690
- 27
2691
- 28</pre>
2692
- </td>
2693
- <td>
2694
- <pre class="code"><span class="info file"># File 'lib/mocha/parameter_matchers/yaml_equivalent.rb', line 26</span>
2695
-
2696
- <span class='kw'>def</span> <span class='id identifier rubyid_yaml_equivalent'>yaml_equivalent</span><span class='lparen'>(</span><span class='id identifier rubyid_object'>object</span><span class='rparen'>)</span>
2697
- <span class='const'>YamlEquivalent</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_object'>object</span><span class='rparen'>)</span>
2698
- <span class='kw'>end</span></pre>
2699
- </td>
2700
- </tr>
2701
- </table>
2702
- </div>
2703
-
2704
- </div>
2705
-
2706
- </div>
2707
-
2708
- <div id="footer">
2709
- Generated on Wed Apr 25 16:51:31 2012 by
2710
- <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
2711
- 0.7.5 (ruby-1.9.3).
2712
- </div>
2713
-
2714
- </body>
2715
- </html>