mocha 1.7.0 → 1.8.0

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