mocha 1.8.0 → 1.11.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (218) hide show
  1. checksums.yaml +4 -4
  2. data/.github/FUNDING.yml +1 -0
  3. data/.rubocop.yml +3 -0
  4. data/.rubocop_todo.yml +7 -30
  5. data/.yardopts +1 -0
  6. data/README.md +40 -13
  7. data/RELEASE.md +97 -0
  8. data/Rakefile +10 -7
  9. data/bin/build-matrix +1 -2
  10. data/docs/CNAME +1 -1
  11. data/docs/Mocha.html +132 -5
  12. data/docs/Mocha/API.html +437 -206
  13. data/docs/Mocha/ClassMethods.html +13 -16
  14. data/docs/Mocha/Configuration.html +1126 -227
  15. data/docs/Mocha/Expectation.html +420 -267
  16. data/docs/Mocha/ExpectationError.html +5 -10
  17. data/docs/Mocha/ExpectationErrorFactory.html +9 -18
  18. data/docs/Mocha/Hooks.html +12 -27
  19. data/docs/Mocha/Integration.html +3 -3
  20. data/docs/Mocha/Integration/MiniTest.html +3 -3
  21. data/docs/Mocha/Integration/MiniTest/Adapter.html +5 -6
  22. data/docs/Mocha/Integration/TestUnit.html +3 -3
  23. data/docs/Mocha/Integration/TestUnit/Adapter.html +5 -6
  24. data/docs/Mocha/Mock.html +202 -162
  25. data/docs/Mocha/ObjectMethods.html +121 -68
  26. data/docs/Mocha/ParameterMatchers.html +21 -109
  27. data/docs/Mocha/ParameterMatchers/AllOf.html +4 -5
  28. data/docs/Mocha/ParameterMatchers/AnyOf.html +4 -5
  29. data/docs/Mocha/ParameterMatchers/AnyParameters.html +3 -3
  30. data/docs/Mocha/ParameterMatchers/Anything.html +3 -3
  31. data/docs/Mocha/ParameterMatchers/Base.html +8 -15
  32. data/docs/Mocha/ParameterMatchers/Equals.html +4 -5
  33. data/docs/Mocha/ParameterMatchers/EquivalentUri.html +3 -3
  34. data/docs/Mocha/ParameterMatchers/HasEntries.html +4 -5
  35. data/docs/Mocha/ParameterMatchers/HasEntry.html +4 -5
  36. data/docs/Mocha/ParameterMatchers/HasKey.html +4 -5
  37. data/docs/Mocha/ParameterMatchers/HasValue.html +4 -5
  38. data/docs/Mocha/ParameterMatchers/Includes.html +4 -5
  39. data/docs/Mocha/ParameterMatchers/InstanceOf.html +4 -5
  40. data/docs/Mocha/ParameterMatchers/IsA.html +3 -3
  41. data/docs/Mocha/ParameterMatchers/KindOf.html +4 -5
  42. data/docs/Mocha/ParameterMatchers/Not.html +4 -5
  43. data/docs/Mocha/ParameterMatchers/Optionally.html +3 -3
  44. data/docs/Mocha/ParameterMatchers/RegexpMatches.html +4 -5
  45. data/docs/Mocha/ParameterMatchers/RespondsWith.html +4 -5
  46. data/docs/Mocha/ParameterMatchers/YamlEquivalent.html +4 -5
  47. data/docs/Mocha/Sequence.html +3 -3
  48. data/docs/Mocha/StateMachine.html +13 -25
  49. data/docs/Mocha/StateMachine/State.html +4 -5
  50. data/docs/Mocha/StateMachine/StatePredicate.html +4 -5
  51. data/docs/Mocha/StubbingError.html +3 -3
  52. data/docs/_index.html +4 -22
  53. data/docs/class_list.html +1 -1
  54. data/docs/file.COPYING.html +3 -3
  55. data/docs/file.MIT-LICENSE.html +3 -3
  56. data/docs/file.README.html +46 -16
  57. data/docs/file.RELEASE.html +130 -3
  58. data/docs/frames.html +1 -1
  59. data/docs/index.html +46 -16
  60. data/docs/js/app.js +11 -0
  61. data/docs/method_list.html +117 -37
  62. data/docs/top-level-namespace.html +3 -3
  63. data/gemfiles/Gemfile.minitest.5.11.3 +7 -0
  64. data/init.rb +1 -3
  65. data/lib/mocha.rb +8 -0
  66. data/lib/mocha/any_instance_method.rb +11 -53
  67. data/lib/mocha/api.rb +120 -56
  68. data/lib/mocha/block_matcher.rb +31 -0
  69. data/lib/mocha/cardinality.rb +26 -11
  70. data/lib/mocha/class_methods.rb +17 -15
  71. data/lib/mocha/configuration.rb +351 -67
  72. data/lib/mocha/deprecation.rb +2 -1
  73. data/lib/mocha/detection/test_unit.rb +1 -3
  74. data/lib/mocha/exception_raiser.rb +2 -1
  75. data/lib/mocha/expectation.rb +102 -63
  76. data/lib/mocha/expectation_error.rb +1 -3
  77. data/lib/mocha/expectation_list.rb +6 -6
  78. data/lib/mocha/inspect.rb +28 -26
  79. data/lib/mocha/instance_method.rb +19 -2
  80. data/lib/mocha/integration.rb +1 -3
  81. data/lib/mocha/integration/mini_test.rb +7 -0
  82. data/lib/mocha/integration/test_unit.rb +7 -0
  83. data/lib/mocha/invocation.rb +77 -0
  84. data/lib/mocha/macos_version.rb +5 -0
  85. data/lib/mocha/minitest.rb +6 -1
  86. data/lib/mocha/mock.rb +46 -31
  87. data/lib/mocha/mockery.rb +25 -61
  88. data/lib/mocha/names.rb +1 -1
  89. data/lib/mocha/object_methods.rb +13 -19
  90. data/lib/mocha/parameter_matchers.rb +1 -1
  91. data/lib/mocha/parameter_matchers/all_of.rb +1 -1
  92. data/lib/mocha/parameter_matchers/any_of.rb +1 -1
  93. data/lib/mocha/parameter_matchers/equivalent_uri.rb +0 -9
  94. data/lib/mocha/parameter_matchers/includes.rb +2 -0
  95. data/lib/mocha/parameter_matchers/instance_methods.rb +18 -0
  96. data/lib/mocha/raised_exception.rb +11 -0
  97. data/lib/mocha/return_values.rb +3 -3
  98. data/lib/mocha/setup.rb +5 -0
  99. data/lib/mocha/single_return_value.rb +2 -1
  100. data/lib/mocha/singleton_class.rb +9 -0
  101. data/lib/mocha/stubbed_method.rb +127 -0
  102. data/lib/mocha/test_unit.rb +6 -1
  103. data/lib/mocha/thrower.rb +2 -1
  104. data/lib/mocha/thrown_object.rb +12 -0
  105. data/lib/mocha/version.rb +1 -1
  106. data/lib/mocha/yield_parameters.rb +5 -11
  107. data/mocha.gemspec +1 -3
  108. data/test/acceptance/acceptance_test_helper.rb +7 -0
  109. data/test/acceptance/bug_18914_test.rb +0 -1
  110. data/test/acceptance/bug_21465_test.rb +0 -1
  111. data/test/acceptance/bug_21563_test.rb +0 -1
  112. data/test/acceptance/display_matching_invocations_alongside_expectations_test.rb +69 -0
  113. data/test/acceptance/exception_rescue_test.rb +1 -2
  114. data/test/acceptance/expectations_on_multiple_methods_test.rb +0 -1
  115. data/test/acceptance/expected_invocation_count_test.rb +2 -3
  116. data/test/acceptance/failure_messages_test.rb +16 -1
  117. data/test/acceptance/issue_272_test.rb +1 -2
  118. data/test/acceptance/issue_65_test.rb +0 -1
  119. data/test/acceptance/issue_70_test.rb +0 -1
  120. data/test/acceptance/mocha_example_test.rb +0 -1
  121. data/test/acceptance/mocha_test_result_test.rb +0 -1
  122. data/test/acceptance/mock_built_with_first_argument_type_being_string_test.rb +99 -0
  123. data/test/acceptance/mock_test.rb +47 -6
  124. data/test/acceptance/mocked_methods_dispatch_test.rb +0 -1
  125. data/test/acceptance/multiple_expectations_failure_message_test.rb +0 -1
  126. data/test/acceptance/multiple_yielding_test.rb +56 -0
  127. data/test/acceptance/optional_parameters_test.rb +0 -1
  128. data/test/acceptance/parameter_matcher_test.rb +0 -1
  129. data/test/acceptance/partial_mocks_test.rb +0 -1
  130. data/test/acceptance/prepend_test.rb +0 -1
  131. data/test/acceptance/prevent_use_of_mocha_outside_test_test.rb +0 -1
  132. data/test/acceptance/raise_exception_test.rb +0 -1
  133. data/test/acceptance/return_value_test.rb +0 -1
  134. data/test/acceptance/sequence_test.rb +0 -1
  135. data/test/acceptance/states_test.rb +0 -1
  136. data/test/acceptance/stub_any_instance_method_defined_on_superclass_test.rb +1 -2
  137. data/test/acceptance/stub_any_instance_method_test.rb +20 -1
  138. data/test/acceptance/stub_class_method_defined_on_active_record_association_proxy_test.rb +0 -1
  139. data/test/acceptance/stub_class_method_defined_on_class_test.rb +0 -1
  140. data/test/acceptance/stub_class_method_defined_on_module_test.rb +0 -1
  141. data/test/acceptance/stub_class_method_defined_on_superclass_test.rb +1 -2
  142. data/test/acceptance/stub_everything_test.rb +0 -1
  143. data/test/acceptance/stub_instance_method_defined_on_active_record_association_proxy_test.rb +0 -1
  144. data/test/acceptance/stub_instance_method_defined_on_class_and_aliased_test.rb +0 -1
  145. data/test/acceptance/stub_instance_method_defined_on_class_test.rb +0 -1
  146. data/test/acceptance/stub_instance_method_defined_on_kernel_module_test.rb +0 -1
  147. data/test/acceptance/stub_instance_method_defined_on_module_test.rb +0 -1
  148. data/test/acceptance/stub_instance_method_defined_on_object_class_test.rb +0 -1
  149. data/test/acceptance/stub_instance_method_defined_on_singleton_class_test.rb +0 -1
  150. data/test/acceptance/stub_instance_method_defined_on_superclass_test.rb +0 -1
  151. data/test/acceptance/stub_method_defined_on_module_and_aliased_test.rb +0 -1
  152. data/test/acceptance/stub_module_method_test.rb +0 -1
  153. data/test/acceptance/stub_test.rb +0 -1
  154. data/test/acceptance/stubba_example_test.rb +0 -1
  155. data/test/acceptance/stubba_test_result_test.rb +0 -1
  156. data/test/acceptance/stubbing_error_backtrace_test.rb +4 -5
  157. data/test/acceptance/stubbing_frozen_object_test.rb +0 -1
  158. data/test/acceptance/stubbing_method_accepting_block_parameter_test.rb +0 -1
  159. data/test/acceptance/stubbing_method_unnecessarily_test.rb +5 -5
  160. data/test/acceptance/stubbing_nil_test.rb +5 -5
  161. data/test/acceptance/stubbing_non_existent_any_instance_method_test.rb +27 -11
  162. data/test/acceptance/stubbing_non_existent_class_method_test.rb +11 -11
  163. data/test/acceptance/stubbing_non_existent_instance_method_test.rb +11 -11
  164. data/test/acceptance/stubbing_non_public_any_instance_method_test.rb +8 -8
  165. data/test/acceptance/stubbing_non_public_class_method_test.rb +9 -9
  166. data/test/acceptance/stubbing_non_public_instance_method_test.rb +9 -9
  167. data/test/acceptance/stubbing_on_non_mock_object_test.rb +5 -5
  168. data/test/acceptance/stubbing_same_class_method_on_parent_and_child_classes_test.rb +0 -1
  169. data/test/acceptance/throw_test.rb +0 -1
  170. data/test/acceptance/unexpected_invocation_test.rb +0 -1
  171. data/test/acceptance/unstubbing_test.rb +0 -1
  172. data/test/acceptance/yielding_test.rb +78 -0
  173. data/test/integration/shared_tests.rb +5 -3
  174. data/test/method_definer.rb +11 -17
  175. data/test/test_runner.rb +2 -0
  176. data/test/unit/any_instance_method_test.rb +60 -35
  177. data/test/unit/cardinality_test.rb +41 -23
  178. data/test/unit/central_test.rb +0 -1
  179. data/test/unit/class_methods_test.rb +1 -1
  180. data/test/unit/configuration_test.rb +12 -12
  181. data/test/unit/exception_raiser_test.rb +10 -5
  182. data/test/unit/expectation_list_test.rb +13 -11
  183. data/test/unit/expectation_test.rb +117 -103
  184. data/test/unit/instance_method_test.rb +282 -0
  185. data/test/unit/mock_test.rb +28 -19
  186. data/test/unit/mockery_test.rb +8 -11
  187. data/test/unit/module_methods_test.rb +2 -3
  188. data/test/unit/object_inspect_test.rb +6 -4
  189. data/test/unit/object_methods_test.rb +3 -2
  190. data/test/unit/parameter_matchers/equivalent_uri_test.rb +0 -9
  191. data/test/unit/parameter_matchers/has_entries_test.rb +1 -1
  192. data/test/unit/parameter_matchers/has_entry_test.rb +1 -1
  193. data/test/unit/parameter_matchers/has_key_test.rb +1 -1
  194. data/test/unit/parameter_matchers/has_value_test.rb +1 -1
  195. data/test/unit/parameter_matchers/includes_test.rb +1 -1
  196. data/test/unit/parameter_matchers/responds_with_test.rb +1 -1
  197. data/test/unit/return_values_test.rb +25 -20
  198. data/test/unit/single_return_value_test.rb +6 -1
  199. data/test/unit/thrower_test.rb +7 -2
  200. data/test/unit/yield_parameters_test.rb +35 -53
  201. metadata +18 -35
  202. data/docs/Mocha/UnexpectedInvocation.html +0 -140
  203. data/lib/mocha/class_method.rb +0 -113
  204. data/lib/mocha/mini_test.rb +0 -5
  205. data/lib/mocha/module_method.rb +0 -6
  206. data/lib/mocha/module_methods.rb +0 -10
  207. data/lib/mocha/multiple_yields.rb +0 -15
  208. data/lib/mocha/no_yields.rb +0 -5
  209. data/lib/mocha/parameter_matchers/object.rb +0 -15
  210. data/lib/mocha/single_yield.rb +0 -13
  211. data/lib/mocha/standalone.rb +0 -4
  212. data/lib/mocha/unexpected_invocation.rb +0 -24
  213. data/lib/mocha_standalone.rb +0 -4
  214. data/test/acceptance/mock_with_initializer_block_test.rb +0 -56
  215. data/test/unit/class_method_test.rb +0 -254
  216. data/test/unit/multiple_yields_test.rb +0 -16
  217. data/test/unit/no_yields_test.rb +0 -16
  218. data/test/unit/single_yield_test.rb +0 -16
@@ -6,7 +6,7 @@
6
6
  <title>
7
7
  Class: Mocha::Expectation
8
8
 
9
- &mdash; Mocha 1.8.0
9
+ &mdash; Mocha 1.11.0
10
10
 
11
11
  </title>
12
12
 
@@ -102,8 +102,7 @@
102
102
  <h2>Overview</h2><div class="docstring">
103
103
  <div class="discussion">
104
104
 
105
- <p>Methods on expectations returned from <span class='object_link'><a href="Mock.html#expects-instance_method" title="Mocha::Mock#expects (method)">Mock#expects</a></span>, <span class='object_link'><a href="Mock.html#stubs-instance_method" title="Mocha::Mock#stubs (method)">Mock#stubs</a></span>,
106
- <span class='object_link'><a href="ObjectMethods.html#expects-instance_method" title="Mocha::ObjectMethods#expects (method)">ObjectMethods#expects</a></span> and <span class='object_link'><a href="ObjectMethods.html#stubs-instance_method" title="Mocha::ObjectMethods#stubs (method)">ObjectMethods#stubs</a></span>.</p>
105
+ <p>Methods on expectations returned from <span class='object_link'><a href="Mock.html#expects-instance_method" title="Mocha::Mock#expects (method)">Mock#expects</a></span>, <span class='object_link'><a href="Mock.html#stubs-instance_method" title="Mocha::Mock#stubs (method)">Mock#stubs</a></span>, <span class='object_link'><a href="ObjectMethods.html#expects-instance_method" title="Mocha::ObjectMethods#expects (method)">ObjectMethods#expects</a></span> and <span class='object_link'><a href="ObjectMethods.html#stubs-instance_method" title="Mocha::ObjectMethods#stubs (method)">ObjectMethods#stubs</a></span>.</p>
107
106
 
108
107
 
109
108
  </div>
@@ -144,8 +143,7 @@
144
143
 
145
144
 
146
145
  <span class="summary_desc"><div class='inline'>
147
- <p>Modifies expectation so that the expected method must be called at least a
148
- <code>minimum_number_of_times</code>.</p>
146
+ <p>Modifies expectation so that the expected method must be called at least a <code>minimum_number_of_times</code>.</p>
149
147
  </div></span>
150
148
 
151
149
  </li>
@@ -169,8 +167,7 @@
169
167
 
170
168
 
171
169
  <span class="summary_desc"><div class='inline'>
172
- <p>Modifies expectation so that the expected method must be called at least
173
- once.</p>
170
+ <p>Modifies expectation so that the expected method must be called at least once.</p>
174
171
  </div></span>
175
172
 
176
173
  </li>
@@ -194,8 +191,7 @@ once.</p>
194
191
 
195
192
 
196
193
  <span class="summary_desc"><div class='inline'>
197
- <p>Modifies expectation so that the expected method must be called at most a
198
- <code>maximum_number_of_times</code>.</p>
194
+ <p>Modifies expectation so that the expected method must be called at most a <code>maximum_number_of_times</code>.</p>
199
195
  </div></span>
200
196
 
201
197
  </li>
@@ -219,8 +215,7 @@ once.</p>
219
215
 
220
216
 
221
217
  <span class="summary_desc"><div class='inline'>
222
- <p>Modifies expectation so that the expected method must be called at most
223
- once.</p>
218
+ <p>Modifies expectation so that the expected method must be called at most once.</p>
224
219
  </div></span>
225
220
 
226
221
  </li>
@@ -229,7 +224,7 @@ once.</p>
229
224
  <li class="public ">
230
225
  <span class="summary_signature">
231
226
 
232
- <a href="#in_sequence-instance_method" title="#in_sequence (instance method)">#<strong>in_sequence</strong>(*sequences) &#x21d2; Expectation </a>
227
+ <a href="#in_sequence-instance_method" title="#in_sequence (instance method)">#<strong>in_sequence</strong>(sequence, *sequences) &#x21d2; Expectation </a>
233
228
 
234
229
 
235
230
 
@@ -244,8 +239,7 @@ once.</p>
244
239
 
245
240
 
246
241
  <span class="summary_desc"><div class='inline'>
247
- <p>Constrains the expectation so that it must be invoked at the current point
248
- in the <code>sequence</code>.</p>
242
+ <p>Constrains the expectation so that it must be invoked at the current point in the <code>sequence</code>.</p>
249
243
  </div></span>
250
244
 
251
245
  </li>
@@ -269,9 +263,7 @@ in the <code>sequence</code>.</p>
269
263
 
270
264
 
271
265
  <span class="summary_desc"><div class='inline'>
272
- <p>Modifies expectation so that when the expected method is called, it yields
273
- multiple times per invocation with the specified
274
- <code>parameter_groups</code>.</p>
266
+ <p>Modifies expectation so that when the expected method is called, it yields multiple times per invocation with the specified <code>parameter_groups</code> (even if no block is provided, in which case yielding will result in a <code>LocalJumpError</code>).</p>
275
267
  </div></span>
276
268
 
277
269
  </li>
@@ -319,8 +311,7 @@ multiple times per invocation with the specified
319
311
 
320
312
 
321
313
  <span class="summary_desc"><div class='inline'>
322
- <p>Modifies expectation so that the expected method must be called exactly
323
- once.</p>
314
+ <p>Modifies expectation so that the expected method must be called exactly once.</p>
324
315
  </div></span>
325
316
 
326
317
  </li>
@@ -344,9 +335,7 @@ once.</p>
344
335
 
345
336
 
346
337
  <span class="summary_desc"><div class='inline'>
347
- <p>Modifies expectation so that when the expected method is called, it raises
348
- the specified <code>exception</code> with the specified
349
- <code>message</code> i.e.</p>
338
+ <p>Modifies expectation so that when the expected method is called, it raises the specified <code>exception</code> with the specified <code>message</code> i.e.</p>
350
339
  </div></span>
351
340
 
352
341
  </li>
@@ -370,8 +359,7 @@ the specified <code>exception</code> with the specified
370
359
 
371
360
 
372
361
  <span class="summary_desc"><div class='inline'>
373
- <p>Modifies expectation so that when the expected method is called, it returns
374
- the specified <code>value</code>.</p>
362
+ <p>Modifies expectation so that when the expected method is called, it returns the specified <code>value</code>.</p>
375
363
  </div></span>
376
364
 
377
365
  </li>
@@ -395,8 +383,7 @@ the specified <code>value</code>.</p>
395
383
 
396
384
 
397
385
  <span class="summary_desc"><div class='inline'>
398
- <p>The same expectation, thereby allowing invocations of other <span class='object_link'><a href="" title="Mocha::Expectation (class)">Expectation</a></span>
399
- methods to be chained.</p>
386
+ <p>The same expectation, thereby allowing invocations of other <span class='object_link'><a href="" title="Mocha::Expectation (class)">Expectation</a></span> methods to be chained.</p>
400
387
  </div></span>
401
388
 
402
389
  </li>
@@ -420,9 +407,7 @@ methods to be chained.</p>
420
407
 
421
408
 
422
409
  <span class="summary_desc"><div class='inline'>
423
- <p>Modifies expectation so that when the expected method is called, it throws
424
- the specified <code>tag</code> with the specific return value
425
- <code>object</code> i.e.</p>
410
+ <p>Modifies expectation so that when the expected method is called, it throws the specified <code>tag</code> with the specific return value <code>object</code> i.e.</p>
426
411
  </div></span>
427
412
 
428
413
  </li>
@@ -446,8 +431,7 @@ the specified <code>tag</code> with the specific return value
446
431
 
447
432
 
448
433
  <span class="summary_desc"><div class='inline'>
449
- <p>Modifies expectation so that the number of calls to the expected method
450
- must be within a specific <code>range</code>.</p>
434
+ <p>Modifies expectation so that the number of calls to the expected method must be within a specific <code>range</code>.</p>
451
435
  </div></span>
452
436
 
453
437
  </li>
@@ -471,8 +455,7 @@ must be within a specific <code>range</code>.</p>
471
455
 
472
456
 
473
457
  <span class="summary_desc"><div class='inline'>
474
- <p>Modifies expectation so that the expected method must be called exactly
475
- twice.</p>
458
+ <p>Modifies expectation so that the expected method must be called exactly twice.</p>
476
459
  </div></span>
477
460
 
478
461
  </li>
@@ -496,9 +479,7 @@ twice.</p>
496
479
 
497
480
 
498
481
  <span class="summary_desc"><div class='inline'>
499
- <p>Constrains the expectation to occur only when the
500
- <code>state_machine</code> is in the state specified by
501
- <code>state_name</code>.</p>
482
+ <p>Constrains the expectation to occur only when the <code>state_machine</code> is in the state specified by <code>state_name</code>.</p>
502
483
  </div></span>
503
484
 
504
485
  </li>
@@ -522,8 +503,55 @@ twice.</p>
522
503
 
523
504
 
524
505
  <span class="summary_desc"><div class='inline'>
525
- <p>Modifies expectation so that the expected method must be called with
526
- <code>expected_parameters</code>.</p>
506
+ <p>Modifies expectation so that the expected method must be called with <code>expected_parameters</code>.</p>
507
+ </div></span>
508
+
509
+ </li>
510
+
511
+
512
+ <li class="public ">
513
+ <span class="summary_signature">
514
+
515
+ <a href="#with_block_given-instance_method" title="#with_block_given (instance method)">#<strong>with_block_given</strong> &#x21d2; Expectation </a>
516
+
517
+
518
+
519
+ </span>
520
+
521
+
522
+
523
+
524
+
525
+
526
+
527
+
528
+
529
+ <span class="summary_desc"><div class='inline'>
530
+ <p>Modifies expectation so that the expected method must be called with a block.</p>
531
+ </div></span>
532
+
533
+ </li>
534
+
535
+
536
+ <li class="public ">
537
+ <span class="summary_signature">
538
+
539
+ <a href="#with_no_block_given-instance_method" title="#with_no_block_given (instance method)">#<strong>with_no_block_given</strong> &#x21d2; Expectation </a>
540
+
541
+
542
+
543
+ </span>
544
+
545
+
546
+
547
+
548
+
549
+
550
+
551
+
552
+
553
+ <span class="summary_desc"><div class='inline'>
554
+ <p>Modifies expectation so that the expected method must be called without a block.</p>
527
555
  </div></span>
528
556
 
529
557
  </li>
@@ -547,8 +575,7 @@ twice.</p>
547
575
 
548
576
 
549
577
  <span class="summary_desc"><div class='inline'>
550
- <p>Modifies expectation so that when the expected method is called, it yields
551
- with the specified <code>parameters</code>.</p>
578
+ <p>Modifies expectation so that when the expected method is called, it yields with the specified <code>parameters</code> (even if no block is provided, in which case yielding will result in a <code>LocalJumpError</code>).</p>
552
579
  </div></span>
553
580
 
554
581
  </li>
@@ -575,8 +602,7 @@ with the specified <code>parameters</code>.</p>
575
602
  </h3><div class="docstring">
576
603
  <div class="discussion">
577
604
 
578
- <p>Modifies expectation so that the expected method must be called at least a
579
- <code>minimum_number_of_times</code>.</p>
605
+ <p>Modifies expectation so that the expected method must be called at least a <code>minimum_number_of_times</code>.</p>
580
606
 
581
607
 
582
608
  </div>
@@ -635,8 +661,7 @@ with the specified <code>parameters</code>.</p>
635
661
 
636
662
  &mdash;
637
663
  <div class='inline'>
638
- <p>the same expectation, thereby allowing invocations of other <span class='object_link'><a href="" title="Mocha::Expectation (class)">Mocha::Expectation</a></span>
639
- methods to be chained.</p>
664
+ <p>the same expectation, thereby allowing invocations of other <span class='object_link'><a href="" title="Mocha::Expectation (class)">Mocha::Expectation</a></span> methods to be chained.</p>
640
665
  </div>
641
666
 
642
667
  </li>
@@ -649,13 +674,13 @@ methods to be chained.</p>
649
674
  <pre class="lines">
650
675
 
651
676
 
652
- 130
653
- 131
654
677
  132
655
- 133</pre>
678
+ 133
679
+ 134
680
+ 135</pre>
656
681
  </td>
657
682
  <td>
658
- <pre class="code"><span class="info file"># File 'lib/mocha/expectation.rb', line 130</span>
683
+ <pre class="code"><span class="info file"># File 'lib/mocha/expectation.rb', line 132</span>
659
684
 
660
685
  <span class='kw'>def</span> <span class='id identifier rubyid_at_least'>at_least</span><span class='lparen'>(</span><span class='id identifier rubyid_minimum_number_of_times'>minimum_number_of_times</span><span class='rparen'>)</span>
661
686
  <span class='ivar'>@cardinality</span> <span class='op'>=</span> <span class='const'>Cardinality</span><span class='period'>.</span><span class='id identifier rubyid_at_least'>at_least</span><span class='lparen'>(</span><span class='id identifier rubyid_minimum_number_of_times'>minimum_number_of_times</span><span class='rparen'>)</span>
@@ -678,8 +703,7 @@ methods to be chained.</p>
678
703
  </h3><div class="docstring">
679
704
  <div class="discussion">
680
705
 
681
- <p>Modifies expectation so that the expected method must be called at least
682
- once.</p>
706
+ <p>Modifies expectation so that the expected method must be called at least once.</p>
683
707
 
684
708
 
685
709
  </div>
@@ -717,8 +741,7 @@ once.</p>
717
741
 
718
742
  &mdash;
719
743
  <div class='inline'>
720
- <p>the same expectation, thereby allowing invocations of other <span class='object_link'><a href="" title="Mocha::Expectation (class)">Mocha::Expectation</a></span>
721
- methods to be chained.</p>
744
+ <p>the same expectation, thereby allowing invocations of other <span class='object_link'><a href="" title="Mocha::Expectation (class)">Mocha::Expectation</a></span> methods to be chained.</p>
722
745
  </div>
723
746
 
724
747
  </li>
@@ -731,13 +754,13 @@ methods to be chained.</p>
731
754
  <pre class="lines">
732
755
 
733
756
 
734
- 148
735
- 149
736
757
  150
737
- 151</pre>
758
+ 151
759
+ 152
760
+ 153</pre>
738
761
  </td>
739
762
  <td>
740
- <pre class="code"><span class="info file"># File 'lib/mocha/expectation.rb', line 148</span>
763
+ <pre class="code"><span class="info file"># File 'lib/mocha/expectation.rb', line 150</span>
741
764
 
742
765
  <span class='kw'>def</span> <span class='id identifier rubyid_at_least_once'>at_least_once</span>
743
766
  <span class='id identifier rubyid_at_least'>at_least</span><span class='lparen'>(</span><span class='int'>1</span><span class='rparen'>)</span>
@@ -760,8 +783,7 @@ methods to be chained.</p>
760
783
  </h3><div class="docstring">
761
784
  <div class="discussion">
762
785
 
763
- <p>Modifies expectation so that the expected method must be called at most a
764
- <code>maximum_number_of_times</code>.</p>
786
+ <p>Modifies expectation so that the expected method must be called at most a <code>maximum_number_of_times</code>.</p>
765
787
 
766
788
 
767
789
  </div>
@@ -819,8 +841,7 @@ methods to be chained.</p>
819
841
 
820
842
  &mdash;
821
843
  <div class='inline'>
822
- <p>the same expectation, thereby allowing invocations of other <span class='object_link'><a href="" title="Mocha::Expectation (class)">Mocha::Expectation</a></span>
823
- methods to be chained.</p>
844
+ <p>the same expectation, thereby allowing invocations of other <span class='object_link'><a href="" title="Mocha::Expectation (class)">Mocha::Expectation</a></span> methods to be chained.</p>
824
845
  </div>
825
846
 
826
847
  </li>
@@ -833,13 +854,13 @@ methods to be chained.</p>
833
854
  <pre class="lines">
834
855
 
835
856
 
836
- 167
837
- 168
838
857
  169
839
- 170</pre>
858
+ 170
859
+ 171
860
+ 172</pre>
840
861
  </td>
841
862
  <td>
842
- <pre class="code"><span class="info file"># File 'lib/mocha/expectation.rb', line 167</span>
863
+ <pre class="code"><span class="info file"># File 'lib/mocha/expectation.rb', line 169</span>
843
864
 
844
865
  <span class='kw'>def</span> <span class='id identifier rubyid_at_most'>at_most</span><span class='lparen'>(</span><span class='id identifier rubyid_maximum_number_of_times'>maximum_number_of_times</span><span class='rparen'>)</span>
845
866
  <span class='ivar'>@cardinality</span> <span class='op'>=</span> <span class='const'>Cardinality</span><span class='period'>.</span><span class='id identifier rubyid_at_most'>at_most</span><span class='lparen'>(</span><span class='id identifier rubyid_maximum_number_of_times'>maximum_number_of_times</span><span class='rparen'>)</span>
@@ -862,8 +883,7 @@ methods to be chained.</p>
862
883
  </h3><div class="docstring">
863
884
  <div class="discussion">
864
885
 
865
- <p>Modifies expectation so that the expected method must be called at most
866
- once.</p>
886
+ <p>Modifies expectation so that the expected method must be called at most once.</p>
867
887
 
868
888
 
869
889
  </div>
@@ -901,8 +921,7 @@ once.</p>
901
921
 
902
922
  &mdash;
903
923
  <div class='inline'>
904
- <p>the same expectation, thereby allowing invocations of other <span class='object_link'><a href="" title="Mocha::Expectation (class)">Mocha::Expectation</a></span>
905
- methods to be chained.</p>
924
+ <p>the same expectation, thereby allowing invocations of other <span class='object_link'><a href="" title="Mocha::Expectation (class)">Mocha::Expectation</a></span> methods to be chained.</p>
906
925
  </div>
907
926
 
908
927
  </li>
@@ -915,13 +934,13 @@ methods to be chained.</p>
915
934
  <pre class="lines">
916
935
 
917
936
 
918
- 185
919
- 186
920
937
  187
921
- 188</pre>
938
+ 188
939
+ 189
940
+ 190</pre>
922
941
  </td>
923
942
  <td>
924
- <pre class="code"><span class="info file"># File 'lib/mocha/expectation.rb', line 185</span>
943
+ <pre class="code"><span class="info file"># File 'lib/mocha/expectation.rb', line 187</span>
925
944
 
926
945
  <span class='kw'>def</span> <span class='id identifier rubyid_at_most_once'>at_most_once</span>
927
946
  <span class='id identifier rubyid_at_most'>at_most</span><span class='lparen'>(</span><span class='int'>1</span><span class='rparen'>)</span>
@@ -935,7 +954,7 @@ methods to be chained.</p>
935
954
  <div class="method_details ">
936
955
  <h3 class="signature " id="in_sequence-instance_method">
937
956
 
938
- #<strong>in_sequence</strong>(*sequences) &#x21d2; <tt><span class='object_link'><a href="" title="Mocha::Expectation (class)">Expectation</a></span></tt>
957
+ #<strong>in_sequence</strong>(sequence, *sequences) &#x21d2; <tt><span class='object_link'><a href="" title="Mocha::Expectation (class)">Expectation</a></span></tt>
939
958
 
940
959
 
941
960
 
@@ -944,16 +963,13 @@ methods to be chained.</p>
944
963
  </h3><div class="docstring">
945
964
  <div class="discussion">
946
965
 
947
- <p>Constrains the expectation so that it must be invoked at the current point
948
- in the <code>sequence</code>.</p>
966
+ <p>Constrains the expectation so that it must be invoked at the current point in the <code>sequence</code>.</p>
949
967
 
950
- <p>To expect a sequence of invocations, write the expectations in order and
951
- add the <tt>in_sequence(sequence)</tt> clause to each one.</p>
968
+ <p>To expect a sequence of invocations, write the expectations in order and add the <tt>in_sequence(sequence)</tt> clause to each one.</p>
952
969
 
953
970
  <p>Expectations in a <code>sequence</code> can have any invocation count.</p>
954
971
 
955
- <p>If an expectation in a sequence is stubbed, rather than expected, it can be
956
- skipped in the <code>sequence</code>.</p>
972
+ <p>If an expectation in a sequence is stubbed, rather than expected, it can be skipped in the <code>sequence</code>.</p>
957
973
 
958
974
  <p>An expected method can appear in multiple sequences.</p>
959
975
 
@@ -981,6 +997,22 @@ skipped in the <code>sequence</code>.</p>
981
997
  <p class="tag_title">Parameters:</p>
982
998
  <ul class="param">
983
999
 
1000
+ <li>
1001
+
1002
+ <span class='name'>sequence</span>
1003
+
1004
+
1005
+ <span class='type'>(<tt><span class='object_link'><a href="Sequence.html" title="Mocha::Sequence (class)">Sequence</a></span></tt>)</span>
1006
+
1007
+
1008
+
1009
+ &mdash;
1010
+ <div class='inline'>
1011
+ <p>sequence in which expected method should appear.</p>
1012
+ </div>
1013
+
1014
+ </li>
1015
+
984
1016
  <li>
985
1017
 
986
1018
  <span class='name'>sequences</span>
@@ -992,7 +1024,7 @@ skipped in the <code>sequence</code>.</p>
992
1024
 
993
1025
  &mdash;
994
1026
  <div class='inline'>
995
- <p>sequences in which expected method should appear.</p>
1027
+ <p>more sequences in which expected method should appear.</p>
996
1028
  </div>
997
1029
 
998
1030
  </li>
@@ -1011,8 +1043,7 @@ skipped in the <code>sequence</code>.</p>
1011
1043
 
1012
1044
  &mdash;
1013
1045
  <div class='inline'>
1014
- <p>the same expectation, thereby allowing invocations of other <span class='object_link'><a href="" title="Mocha::Expectation (class)">Mocha::Expectation</a></span>
1015
- methods to be chained.</p>
1046
+ <p>the same expectation, thereby allowing invocations of other <span class='object_link'><a href="" title="Mocha::Expectation (class)">Mocha::Expectation</a></span> methods to be chained.</p>
1016
1047
  </div>
1017
1048
 
1018
1049
  </li>
@@ -1032,16 +1063,16 @@ methods to be chained.</p>
1032
1063
  <pre class="lines">
1033
1064
 
1034
1065
 
1035
- 492
1036
- 493
1037
- 494
1038
- 495</pre>
1066
+ 539
1067
+ 540
1068
+ 541
1069
+ 542</pre>
1039
1070
  </td>
1040
1071
  <td>
1041
- <pre class="code"><span class="info file"># File 'lib/mocha/expectation.rb', line 492</span>
1072
+ <pre class="code"><span class="info file"># File 'lib/mocha/expectation.rb', line 539</span>
1042
1073
 
1043
- <span class='kw'>def</span> <span class='id identifier rubyid_in_sequence'>in_sequence</span><span class='lparen'>(</span><span class='op'>*</span><span class='id identifier rubyid_sequences'>sequences</span><span class='rparen'>)</span>
1044
- <span class='id identifier rubyid_sequences'>sequences</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_sequence'>sequence</span><span class='op'>|</span> <span class='id identifier rubyid_add_in_sequence_ordering_constraint'>add_in_sequence_ordering_constraint</span><span class='lparen'>(</span><span class='id identifier rubyid_sequence'>sequence</span><span class='rparen'>)</span> <span class='rbrace'>}</span>
1074
+ <span class='kw'>def</span> <span class='id identifier rubyid_in_sequence'>in_sequence</span><span class='lparen'>(</span><span class='id identifier rubyid_sequence'>sequence</span><span class='comma'>,</span> <span class='op'>*</span><span class='id identifier rubyid_sequences'>sequences</span><span class='rparen'>)</span>
1075
+ <span class='id identifier rubyid_sequences'>sequences</span><span class='period'>.</span><span class='id identifier rubyid_unshift'>unshift</span><span class='lparen'>(</span><span class='id identifier rubyid_sequence'>sequence</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_seq'>seq</span><span class='op'>|</span> <span class='id identifier rubyid_add_in_sequence_ordering_constraint'>add_in_sequence_ordering_constraint</span><span class='lparen'>(</span><span class='id identifier rubyid_seq'>seq</span><span class='rparen'>)</span> <span class='rbrace'>}</span>
1045
1076
  <span class='kw'>self</span>
1046
1077
  <span class='kw'>end</span></pre>
1047
1078
  </td>
@@ -1061,9 +1092,7 @@ methods to be chained.</p>
1061
1092
  </h3><div class="docstring">
1062
1093
  <div class="discussion">
1063
1094
 
1064
- <p>Modifies expectation so that when the expected method is called, it yields
1065
- multiple times per invocation with the specified
1066
- <code>parameter_groups</code>.</p>
1095
+ <p>Modifies expectation so that when the expected method is called, it yields multiple times per invocation with the specified <code>parameter_groups</code> (even if no block is provided, in which case yielding will result in a <code>LocalJumpError</code>).</p>
1067
1096
 
1068
1097
 
1069
1098
  </div>
@@ -1075,32 +1104,28 @@ multiple times per invocation with the specified
1075
1104
 
1076
1105
 
1077
1106
  <p class="example_title"><div class='inline'>
1078
- <p>When the <code>expected_method</code> is called, the stub will invoke the
1079
- block twice, the first time it passes <tt>&#39;result_1&#39;</tt>,
1080
- <tt>&#39;result_2&#39;</tt> as the parameters, and the second time it passes
1081
- &#39;result_3&#39; as the parameters.</p>
1107
+ <p>When <code>foreach</code> is called, the stub will invoke the block twice, the first time it passes [&#39;row1_col1&#39;, &#39;row1_col2&#39;] as the parameters, and the second time it passes [&#39;row2_col1&#39;, &#39;&#39;] as the parameters.</p>
1082
1108
  </div></p>
1083
1109
 
1084
- <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>
1085
- <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'>:expected_method</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_multiple_yields'>multiple_yields</span><span class='lparen'>(</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>result_1</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'>result_2</span><span class='tstring_end'>&#39;</span></span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>result_3</span><span class='tstring_end'>&#39;</span></span><span class='rbracket'>]</span><span class='rparen'>)</span>
1086
- <span class='id identifier rubyid_yielded_values'>yielded_values</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
1087
- <span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_expected_method'>expected_method</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='op'>*</span><span class='id identifier rubyid_values'>values</span><span class='op'>|</span> <span class='id identifier rubyid_yielded_values'>yielded_values</span> <span class='op'>&lt;&lt;</span> <span class='id identifier rubyid_values'>values</span> <span class='rbrace'>}</span>
1088
- <span class='id identifier rubyid_yielded_values'>yielded_values</span> <span class='comment'># =&gt; [[&#39;result_1&#39;, &#39;result_2&#39;], [&#39;result_3]]</span></code></pre>
1110
+ <pre class="example code"><code><span class='id identifier rubyid_csv'>csv</span> <span class='op'>=</span> <span class='id identifier rubyid_mock'>mock</span><span class='lparen'>(</span><span class='rparen'>)</span>
1111
+ <span class='id identifier rubyid_csv'>csv</span><span class='period'>.</span><span class='id identifier rubyid_expects'>expects</span><span class='lparen'>(</span><span class='symbol'>:foreach</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_with'>with</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>path/to/file.csv</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_multiple_yields'>multiple_yields</span><span class='lparen'>(</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>row1_col1</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'>row1_col2</span><span class='tstring_end'>&#39;</span></span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>row2_col1</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_end'>&#39;</span></span><span class='rbracket'>]</span><span class='rparen'>)</span>
1112
+ <span class='id identifier rubyid_rows'>rows</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
1113
+ <span class='id identifier rubyid_csv'>csv</span><span class='period'>.</span><span class='id identifier rubyid_foreach'>foreach</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_row'>row</span><span class='op'>|</span> <span class='id identifier rubyid_rows'>rows</span> <span class='op'>&lt;&lt;</span> <span class='id identifier rubyid_row'>row</span> <span class='rbrace'>}</span>
1114
+ <span class='id identifier rubyid_rows'>rows</span> <span class='comment'># =&gt; [[&#39;row1_col1&#39;, &#39;row1_col2&#39;], [&#39;row2_col1&#39;, &#39;&#39;]]</span></code></pre>
1089
1115
 
1090
1116
 
1091
1117
  <p class="example_title"><div class='inline'>
1092
- <p>Yield different groups of parameters on different invocations of the
1093
- expected method.</p>
1118
+ <p>Yield different groups of parameters on different invocations of the expected method. Simulating a situation where the CSV file at &#39;path/to/file.csv&#39; has been modified between the two calls to <code>foreach</code>.</p>
1094
1119
  </div></p>
1095
1120
 
1096
- <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>
1097
- <span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_stubs'>stubs</span><span class='lparen'>(</span><span class='symbol'>:expected_method</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_multiple_yields'>multiple_yields</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='comma'>,</span> <span class='lbracket'>[</span><span class='int'>3</span><span class='rbracket'>]</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_then'>then</span><span class='period'>.</span><span class='id identifier rubyid_multiple_yields'>multiple_yields</span><span class='lparen'>(</span><span class='lbracket'>[</span><span class='int'>4</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='lbracket'>[</span><span class='int'>5</span><span class='comma'>,</span> <span class='int'>6</span><span class='rbracket'>]</span><span class='rparen'>)</span>
1098
- <span class='id identifier rubyid_yielded_values_from_first_invocation'>yielded_values_from_first_invocation</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
1099
- <span class='id identifier rubyid_yielded_values_from_second_invocation'>yielded_values_from_second_invocation</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
1100
- <span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_expected_method'>expected_method</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='op'>*</span><span class='id identifier rubyid_values'>values</span><span class='op'>|</span> <span class='id identifier rubyid_yielded_values_from_first_invocation'>yielded_values_from_first_invocation</span> <span class='op'>&lt;&lt;</span> <span class='id identifier rubyid_values'>values</span> <span class='rbrace'>}</span> <span class='comment'># first invocation
1101
- </span><span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_expected_method'>expected_method</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='op'>*</span><span class='id identifier rubyid_values'>values</span><span class='op'>|</span> <span class='id identifier rubyid_yielded_values_from_second_invocation'>yielded_values_from_second_invocation</span> <span class='op'>&lt;&lt;</span> <span class='id identifier rubyid_values'>values</span> <span class='rbrace'>}</span> <span class='comment'># second invocation
1102
- </span><span class='id identifier rubyid_yielded_values_from_first_invocation'>yielded_values_from_first_invocation</span> <span class='comment'># =&gt; [[1, 2], [3]]
1103
- </span><span class='id identifier rubyid_yielded_values_from_second_invocation'>yielded_values_from_second_invocation</span> <span class='comment'># =&gt; [[4], [5, 6]]</span></code></pre>
1121
+ <pre class="example code"><code><span class='id identifier rubyid_csv'>csv</span> <span class='op'>=</span> <span class='id identifier rubyid_mock'>mock</span><span class='lparen'>(</span><span class='rparen'>)</span>
1122
+ <span class='id identifier rubyid_csv'>csv</span><span class='period'>.</span><span class='id identifier rubyid_stubs'>stubs</span><span class='lparen'>(</span><span class='symbol'>:foreach</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_with'>with</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>path/to/file.csv</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_multiple_yields'>multiple_yields</span><span class='lparen'>(</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>old_row1_col1</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'>old_row1_col2</span><span class='tstring_end'>&#39;</span></span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>old_row2_col1</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_end'>&#39;</span></span><span class='rbracket'>]</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_then'>then</span><span class='period'>.</span><span class='id identifier rubyid_multiple_yields'>multiple_yields</span><span class='lparen'>(</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>new_row1_col1</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_end'>&#39;</span></span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>new_row2_col1</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'>new_row2_col2</span><span class='tstring_end'>&#39;</span></span><span class='rbracket'>]</span><span class='rparen'>)</span>
1123
+ <span class='id identifier rubyid_rows_from_first_invocation'>rows_from_first_invocation</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
1124
+ <span class='id identifier rubyid_rows_from_second_invocation'>rows_from_second_invocation</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
1125
+ <span class='id identifier rubyid_csv'>csv</span><span class='period'>.</span><span class='id identifier rubyid_foreach'>foreach</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_row'>row</span><span class='op'>|</span> <span class='id identifier rubyid_rows_from_first_invocation'>rows_from_first_invocation</span> <span class='op'>&lt;&lt;</span> <span class='id identifier rubyid_row'>row</span> <span class='rbrace'>}</span> <span class='comment'># first invocation
1126
+ </span><span class='id identifier rubyid_csv'>csv</span><span class='period'>.</span><span class='id identifier rubyid_foreach'>foreach</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_row'>row</span><span class='op'>|</span> <span class='id identifier rubyid_rows_from_second_invocation'>rows_from_second_invocation</span> <span class='op'>&lt;&lt;</span> <span class='id identifier rubyid_row'>row</span> <span class='rbrace'>}</span> <span class='comment'># second invocation
1127
+ </span><span class='id identifier rubyid_rows_from_first_invocation'>rows_from_first_invocation</span> <span class='comment'># =&gt; [[&#39;old_row1_col1&#39;, &#39;old_row1_col2&#39;], [&#39;old_row2_col1&#39;, &#39;&#39;]]
1128
+ </span><span class='id identifier rubyid_rows_from_second_invocation'>rows_from_second_invocation</span> <span class='comment'># =&gt; [[&#39;new_row1_col1&#39;, &#39;&#39;], [&#39;new_row2_col1&#39;, &#39;new_row2_col2&#39;]]</span></code></pre>
1104
1129
 
1105
1130
  </div>
1106
1131
  <p class="tag_title">Parameters:</p>
@@ -1117,9 +1142,7 @@ expected method.</p>
1117
1142
 
1118
1143
  &mdash;
1119
1144
  <div class='inline'>
1120
- <p>each element of <code>parameter_groups</code> should iself be an
1121
- <code>Array</code> representing the parameters to be passed to the block
1122
- for a single yield.</p>
1145
+ <p>each element of <code>parameter_groups</code> should iself be an <code>Array</code> representing the parameters to be passed to the block for a single yield. Any element of <code>parameter_groups</code> that is not an <code>Array</code> is wrapped in an <code>Array</code>.</p>
1123
1146
  </div>
1124
1147
 
1125
1148
  </li>
@@ -1138,8 +1161,7 @@ for a single yield.</p>
1138
1161
 
1139
1162
  &mdash;
1140
1163
  <div class='inline'>
1141
- <p>the same expectation, thereby allowing invocations of other <span class='object_link'><a href="" title="Mocha::Expectation (class)">Mocha::Expectation</a></span>
1142
- methods to be chained.</p>
1164
+ <p>the same expectation, thereby allowing invocations of other <span class='object_link'><a href="" title="Mocha::Expectation (class)">Mocha::Expectation</a></span> methods to be chained.</p>
1143
1165
  </div>
1144
1166
 
1145
1167
  </li>
@@ -1159,16 +1181,16 @@ methods to be chained.</p>
1159
1181
  <pre class="lines">
1160
1182
 
1161
1183
 
1162
- 277
1163
- 278
1164
- 279
1165
- 280</pre>
1184
+ 323
1185
+ 324
1186
+ 325
1187
+ 326</pre>
1166
1188
  </td>
1167
1189
  <td>
1168
- <pre class="code"><span class="info file"># File 'lib/mocha/expectation.rb', line 277</span>
1190
+ <pre class="code"><span class="info file"># File 'lib/mocha/expectation.rb', line 323</span>
1169
1191
 
1170
1192
  <span class='kw'>def</span> <span class='id identifier rubyid_multiple_yields'>multiple_yields</span><span class='lparen'>(</span><span class='op'>*</span><span class='id identifier rubyid_parameter_groups'>parameter_groups</span><span class='rparen'>)</span>
1171
- <span class='ivar'>@yield_parameters</span><span class='period'>.</span><span class='id identifier rubyid_multiple_add'>multiple_add</span><span class='lparen'>(</span><span class='op'>*</span><span class='id identifier rubyid_parameter_groups'>parameter_groups</span><span class='rparen'>)</span>
1193
+ <span class='ivar'>@yield_parameters</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span><span class='lparen'>(</span><span class='op'>*</span><span class='id identifier rubyid_parameter_groups'>parameter_groups</span><span class='rparen'>)</span>
1172
1194
  <span class='kw'>self</span>
1173
1195
  <span class='kw'>end</span></pre>
1174
1196
  </td>
@@ -1225,8 +1247,7 @@ methods to be chained.</p>
1225
1247
 
1226
1248
  &mdash;
1227
1249
  <div class='inline'>
1228
- <p>the same expectation, thereby allowing invocations of other <span class='object_link'><a href="" title="Mocha::Expectation (class)">Mocha::Expectation</a></span>
1229
- methods to be chained.</p>
1250
+ <p>the same expectation, thereby allowing invocations of other <span class='object_link'><a href="" title="Mocha::Expectation (class)">Mocha::Expectation</a></span> methods to be chained.</p>
1230
1251
  </div>
1231
1252
 
1232
1253
  </li>
@@ -1239,13 +1260,13 @@ methods to be chained.</p>
1239
1260
  <pre class="lines">
1240
1261
 
1241
1262
 
1242
- 110
1243
- 111
1244
1263
  112
1245
- 113</pre>
1264
+ 113
1265
+ 114
1266
+ 115</pre>
1246
1267
  </td>
1247
1268
  <td>
1248
- <pre class="code"><span class="info file"># File 'lib/mocha/expectation.rb', line 110</span>
1269
+ <pre class="code"><span class="info file"># File 'lib/mocha/expectation.rb', line 112</span>
1249
1270
 
1250
1271
  <span class='kw'>def</span> <span class='id identifier rubyid_never'>never</span>
1251
1272
  <span class='ivar'>@cardinality</span> <span class='op'>=</span> <span class='const'>Cardinality</span><span class='period'>.</span><span class='id identifier rubyid_exactly'>exactly</span><span class='lparen'>(</span><span class='int'>0</span><span class='rparen'>)</span>
@@ -1268,11 +1289,9 @@ methods to be chained.</p>
1268
1289
  </h3><div class="docstring">
1269
1290
  <div class="discussion">
1270
1291
 
1271
- <p>Modifies expectation so that the expected method must be called exactly
1272
- once.</p>
1292
+ <p>Modifies expectation so that the expected method must be called exactly once.</p>
1273
1293
 
1274
- <p>Note that this is the default behaviour for an expectation, but you may
1275
- wish to use it for clarity/emphasis.</p>
1294
+ <p>Note that this is the default behaviour for an expectation, but you may wish to use it for clarity/emphasis.</p>
1276
1295
 
1277
1296
 
1278
1297
  </div>
@@ -1315,8 +1334,7 @@ wish to use it for clarity/emphasis.</p>
1315
1334
 
1316
1335
  &mdash;
1317
1336
  <div class='inline'>
1318
- <p>the same expectation, thereby allowing invocations of other <span class='object_link'><a href="" title="Mocha::Expectation (class)">Mocha::Expectation</a></span>
1319
- methods to be chained.</p>
1337
+ <p>the same expectation, thereby allowing invocations of other <span class='object_link'><a href="" title="Mocha::Expectation (class)">Mocha::Expectation</a></span> methods to be chained.</p>
1320
1338
  </div>
1321
1339
 
1322
1340
  </li>
@@ -1329,13 +1347,13 @@ methods to be chained.</p>
1329
1347
  <pre class="lines">
1330
1348
 
1331
1349
 
1332
- 93
1333
- 94
1334
1350
  95
1335
- 96</pre>
1351
+ 96
1352
+ 97
1353
+ 98</pre>
1336
1354
  </td>
1337
1355
  <td>
1338
- <pre class="code"><span class="info file"># File 'lib/mocha/expectation.rb', line 93</span>
1356
+ <pre class="code"><span class="info file"># File 'lib/mocha/expectation.rb', line 95</span>
1339
1357
 
1340
1358
  <span class='kw'>def</span> <span class='id identifier rubyid_once'>once</span>
1341
1359
  <span class='ivar'>@cardinality</span> <span class='op'>=</span> <span class='const'>Cardinality</span><span class='period'>.</span><span class='id identifier rubyid_exactly'>exactly</span><span class='lparen'>(</span><span class='int'>1</span><span class='rparen'>)</span>
@@ -1364,9 +1382,7 @@ methods to be chained.</p>
1364
1382
  </h3><div class="docstring">
1365
1383
  <div class="discussion">
1366
1384
 
1367
- <p>Modifies expectation so that when the expected method is called, it raises
1368
- the specified <code>exception</code> with the specified
1369
- <code>message</code> i.e. calls <tt>Kernel#raise(exception, message)</tt>.</p>
1385
+ <p>Modifies expectation so that when the expected method is called, it raises the specified <code>exception</code> with the specified <code>message</code> i.e. calls <tt>Kernel#raise(exception, message)</tt>.</p>
1370
1386
 
1371
1387
 
1372
1388
  </div>
@@ -1387,8 +1403,7 @@ the specified <code>exception</code> with the specified
1387
1403
 
1388
1404
 
1389
1405
  <p class="example_title"><div class='inline'>
1390
- <p>Raise custom exception with extra constructor parameters by passing in an
1391
- instance of the exception.</p>
1406
+ <p>Raise custom exception with extra constructor parameters by passing in an instance of the exception.</p>
1392
1407
  </div></p>
1393
1408
 
1394
1409
  <pre class="example code"><code><span class='id identifier rubyid_object'>object</span> <span class='op'>=</span> <span class='id identifier rubyid_stub'>stub</span><span class='lparen'>(</span><span class='rparen'>)</span>
@@ -1397,8 +1412,7 @@ instance of the exception.</p>
1397
1412
 
1398
1413
 
1399
1414
  <p class="example_title"><div class='inline'>
1400
- <p>Raise different exceptions on consecutive invocations of the expected
1401
- method.</p>
1415
+ <p>Raise different exceptions on consecutive invocations of the expected method.</p>
1402
1416
  </div></p>
1403
1417
 
1404
1418
  <pre class="example code"><code><span class='id identifier rubyid_object'>object</span> <span class='op'>=</span> <span class='id identifier rubyid_stub'>stub</span><span class='lparen'>(</span><span class='rparen'>)</span>
@@ -1408,8 +1422,7 @@ method.</p>
1408
1422
 
1409
1423
 
1410
1424
  <p class="example_title"><div class='inline'>
1411
- <p>Raise an exception on first invocation of expected method and then return
1412
- values on subsequent invocations.</p>
1425
+ <p>Raise an exception on first invocation of expected method and then return values on subsequent invocations.</p>
1413
1426
  </div></p>
1414
1427
 
1415
1428
  <pre class="example code"><code><span class='id identifier rubyid_object'>object</span> <span class='op'>=</span> <span class='id identifier rubyid_stub'>stub</span><span class='lparen'>(</span><span class='rparen'>)</span>
@@ -1472,8 +1485,7 @@ values on subsequent invocations.</p>
1472
1485
 
1473
1486
  &mdash;
1474
1487
  <div class='inline'>
1475
- <p>the same expectation, thereby allowing invocations of other <span class='object_link'><a href="" title="Mocha::Expectation (class)">Mocha::Expectation</a></span>
1476
- methods to be chained.</p>
1488
+ <p>the same expectation, thereby allowing invocations of other <span class='object_link'><a href="" title="Mocha::Expectation (class)">Mocha::Expectation</a></span> methods to be chained.</p>
1477
1489
  </div>
1478
1490
 
1479
1491
  </li>
@@ -1495,13 +1507,13 @@ methods to be chained.</p>
1495
1507
  <pre class="lines">
1496
1508
 
1497
1509
 
1498
- 364
1499
- 365
1500
- 366
1501
- 367</pre>
1510
+ 410
1511
+ 411
1512
+ 412
1513
+ 413</pre>
1502
1514
  </td>
1503
1515
  <td>
1504
- <pre class="code"><span class="info file"># File 'lib/mocha/expectation.rb', line 364</span>
1516
+ <pre class="code"><span class="info file"># File 'lib/mocha/expectation.rb', line 410</span>
1505
1517
 
1506
1518
  <span class='kw'>def</span> <span class='id identifier rubyid_raises'>raises</span><span class='lparen'>(</span><span class='id identifier rubyid_exception'>exception</span> <span class='op'>=</span> <span class='const'>RuntimeError</span><span class='comma'>,</span> <span class='id identifier rubyid_message'>message</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
1507
1519
  <span class='ivar'>@return_values</span> <span class='op'>+=</span> <span class='const'>ReturnValues</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='const'>ExceptionRaiser</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_exception'>exception</span><span class='comma'>,</span> <span class='id identifier rubyid_message'>message</span><span class='rparen'>)</span><span class='rparen'>)</span>
@@ -1528,8 +1540,7 @@ methods to be chained.</p>
1528
1540
  </h3><div class="docstring">
1529
1541
  <div class="discussion">
1530
1542
 
1531
- <p>Modifies expectation so that when the expected method is called, it returns
1532
- the specified <code>value</code>.</p>
1543
+ <p>Modifies expectation so that when the expected method is called, it returns the specified <code>value</code>.</p>
1533
1544
 
1534
1545
 
1535
1546
  </div>
@@ -1583,8 +1594,7 @@ the specified <code>value</code>.</p>
1583
1594
 
1584
1595
 
1585
1596
  <p class="example_title"><div class='inline'>
1586
- <p>Note that in Ruby a method returning multiple values is exactly equivalent
1587
- to a method returning an <code>Array</code> of those values.</p>
1597
+ <p>Note that in Ruby a method returning multiple values is exactly equivalent to a method returning an <code>Array</code> of those values.</p>
1588
1598
  </div></p>
1589
1599
 
1590
1600
  <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>
@@ -1682,8 +1692,7 @@ to a method returning an <code>Array</code> of those values.</p>
1682
1692
 
1683
1693
  &mdash;
1684
1694
  <div class='inline'>
1685
- <p>the same expectation, thereby allowing invocations of other <span class='object_link'><a href="" title="Mocha::Expectation (class)">Mocha::Expectation</a></span>
1686
- methods to be chained.</p>
1695
+ <p>the same expectation, thereby allowing invocations of other <span class='object_link'><a href="" title="Mocha::Expectation (class)">Mocha::Expectation</a></span> methods to be chained.</p>
1687
1696
  </div>
1688
1697
 
1689
1698
  </li>
@@ -1703,13 +1712,13 @@ methods to be chained.</p>
1703
1712
  <pre class="lines">
1704
1713
 
1705
1714
 
1706
- 324
1707
- 325
1708
- 326
1709
- 327</pre>
1715
+ 370
1716
+ 371
1717
+ 372
1718
+ 373</pre>
1710
1719
  </td>
1711
1720
  <td>
1712
- <pre class="code"><span class="info file"># File 'lib/mocha/expectation.rb', line 324</span>
1721
+ <pre class="code"><span class="info file"># File 'lib/mocha/expectation.rb', line 370</span>
1713
1722
 
1714
1723
  <span class='kw'>def</span> <span class='id identifier rubyid_returns'>returns</span><span class='lparen'>(</span><span class='op'>*</span><span class='id identifier rubyid_values'>values</span><span class='rparen'>)</span>
1715
1724
  <span class='ivar'>@return_values</span> <span class='op'>+=</span> <span class='const'>ReturnValues</span><span class='period'>.</span><span class='id identifier rubyid_build'>build</span><span class='lparen'>(</span><span class='op'>*</span><span class='id identifier rubyid_values'>values</span><span class='rparen'>)</span>
@@ -1736,8 +1745,7 @@ methods to be chained.</p>
1736
1745
  </h3><div class="docstring">
1737
1746
  <div class="discussion">
1738
1747
 
1739
- <p>Returns the same expectation, thereby allowing invocations of other
1740
- <span class='object_link'><a href="" title="Mocha::Expectation (class)">Mocha::Expectation</a></span> methods to be chained.</p>
1748
+ <p>Returns the same expectation, thereby allowing invocations of other <span class='object_link'><a href="" title="Mocha::Expectation (class)">Mocha::Expectation</a></span> methods to be chained.</p>
1741
1749
 
1742
1750
 
1743
1751
  </div>
@@ -1749,8 +1757,7 @@ methods to be chained.</p>
1749
1757
 
1750
1758
 
1751
1759
  <p class="example_title"><div class='inline'>
1752
- <p>Using <span class='object_link'><a href="#then-instance_method" title="Mocha::Expectation#then (method)">#then</a></span> as syntactic sugar when specifying values to be returned and
1753
- exceptions to be raised on consecutive invocations of the expected method.</p>
1760
+ <p>Using <span class='object_link'><a href="#then-instance_method" title="Mocha::Expectation#then (method)">#then</a></span> as syntactic sugar when specifying values to be returned and exceptions to be raised on consecutive invocations of the expected method.</p>
1754
1761
  </div></p>
1755
1762
 
1756
1763
  <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>
@@ -1762,8 +1769,7 @@ exceptions to be raised on consecutive invocations of the expected method.</p>
1762
1769
 
1763
1770
 
1764
1771
  <p class="example_title"><div class='inline'>
1765
- <p>Using <span class='object_link'><a href="#then-instance_method" title="Mocha::Expectation#then (method)">#then</a></span> to change the <code>state</code> of a
1766
- <code>state_machine</code> on the invocation of an expected method.</p>
1772
+ <p>Using <span class='object_link'><a href="#then-instance_method" title="Mocha::Expectation#then (method)">#then</a></span> to change the <code>state</code> of a <code>state_machine</code> on the invocation of an expected method.</p>
1767
1773
  </div></p>
1768
1774
 
1769
1775
  <pre class="example code"><code><span class='id identifier rubyid_power'>power</span> <span class='op'>=</span> <span class='id identifier rubyid_states'>states</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>power</span><span class='tstring_end'>&#39;</span></span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_starts_as'>starts_as</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>off</span><span class='tstring_end'>&#39;</span></span><span class='rparen'>)</span>
@@ -1787,8 +1793,7 @@ exceptions to be raised on consecutive invocations of the expected method.</p>
1787
1793
  <div class="docstring">
1788
1794
  <div class="discussion">
1789
1795
 
1790
- <p>Used as syntactic sugar to improve readability. It has no effect on state
1791
- of the expectation.</p>
1796
+ <p>Used as syntactic sugar to improve readability. It has no effect on state of the expectation.</p>
1792
1797
 
1793
1798
 
1794
1799
  </div>
@@ -1805,8 +1810,7 @@ of the expectation.</p>
1805
1810
  <div class="docstring">
1806
1811
  <div class="discussion">
1807
1812
 
1808
- <p>Used to change the <code>state_machine</code> to the state specified by
1809
- <code>state_name</code> when the expected invocation occurs.</p>
1813
+ <p>Used to change the <code>state_machine</code> to the state specified by <code>state_name</code> when the expected invocation occurs.</p>
1810
1814
 
1811
1815
 
1812
1816
  </div>
@@ -1826,9 +1830,7 @@ of the expectation.</p>
1826
1830
 
1827
1831
  &mdash;
1828
1832
  <div class='inline'>
1829
- <p>provides a mechanism to change the <code>state_machine</code> into the
1830
- state specified by <code>state_name</code> when the expected method is
1831
- invoked.</p>
1833
+ <p>provides a mechanism to change the <code>state_machine</code> into the state specified by <code>state_name</code> when the expected method is invoked.</p>
1832
1834
  </div>
1833
1835
 
1834
1836
  </li>
@@ -1864,8 +1866,7 @@ invoked.</p>
1864
1866
 
1865
1867
  &mdash;
1866
1868
  <div class='inline'>
1867
- <p>the same expectation, thereby allowing invocations of other <span class='object_link'><a href="" title="Mocha::Expectation (class)">Mocha::Expectation</a></span>
1868
- methods to be chained.</p>
1869
+ <p>the same expectation, thereby allowing invocations of other <span class='object_link'><a href="" title="Mocha::Expectation (class)">Mocha::Expectation</a></span> methods to be chained.</p>
1869
1870
  </div>
1870
1871
 
1871
1872
  </li>
@@ -1878,16 +1879,16 @@ methods to be chained.</p>
1878
1879
  <pre class="lines">
1879
1880
 
1880
1881
 
1881
- 438
1882
- 439
1883
- 440
1884
- 441
1885
- 442
1886
- 443
1887
- 444</pre>
1882
+ 484
1883
+ 485
1884
+ 486
1885
+ 487
1886
+ 488
1887
+ 489
1888
+ 490</pre>
1888
1889
  </td>
1889
1890
  <td>
1890
- <pre class="code"><span class="info file"># File 'lib/mocha/expectation.rb', line 438</span>
1891
+ <pre class="code"><span class="info file"># File 'lib/mocha/expectation.rb', line 484</span>
1891
1892
 
1892
1893
  <span class='kw'>def</span> <span class='kw'>then</span><span class='lparen'>(</span><span class='op'>*</span><span class='id identifier rubyid_parameters'>parameters</span><span class='rparen'>)</span>
1893
1894
  <span class='kw'>if</span> <span class='id identifier rubyid_parameters'>parameters</span><span class='period'>.</span><span class='id identifier rubyid_length'>length</span> <span class='op'>==</span> <span class='int'>1</span>
@@ -1917,9 +1918,7 @@ methods to be chained.</p>
1917
1918
  </h3><div class="docstring">
1918
1919
  <div class="discussion">
1919
1920
 
1920
- <p>Modifies expectation so that when the expected method is called, it throws
1921
- the specified <code>tag</code> with the specific return value
1922
- <code>object</code> i.e. calls <tt>Kernel#throw(tag, object)</tt>.</p>
1921
+ <p>Modifies expectation so that when the expected method is called, it throws the specified <code>tag</code> with the specific return value <code>object</code> i.e. calls <tt>Kernel#throw(tag, object)</tt>.</p>
1923
1922
 
1924
1923
 
1925
1924
  </div>
@@ -1959,8 +1958,7 @@ the specified <code>tag</code> with the specific return value
1959
1958
 
1960
1959
 
1961
1960
  <p class="example_title"><div class='inline'>
1962
- <p>Throw tag on first invocation of expected method and then return values for
1963
- subsequent invocations.</p>
1961
+ <p>Throw tag on first invocation of expected method and then return values for subsequent invocations.</p>
1964
1962
  </div></p>
1965
1963
 
1966
1964
  <pre class="example code"><code><span class='id identifier rubyid_object'>object</span> <span class='op'>=</span> <span class='id identifier rubyid_stub'>stub</span><span class='lparen'>(</span><span class='rparen'>)</span>
@@ -2021,8 +2019,7 @@ subsequent invocations.</p>
2021
2019
 
2022
2020
  &mdash;
2023
2021
  <div class='inline'>
2024
- <p>the same expectation, thereby allowing invocations of other <span class='object_link'><a href="" title="Mocha::Expectation (class)">Mocha::Expectation</a></span>
2025
- methods to be chained.</p>
2022
+ <p>the same expectation, thereby allowing invocations of other <span class='object_link'><a href="" title="Mocha::Expectation (class)">Mocha::Expectation</a></span> methods to be chained.</p>
2026
2023
  </div>
2027
2024
 
2028
2025
  </li>
@@ -2044,13 +2041,13 @@ methods to be chained.</p>
2044
2041
  <pre class="lines">
2045
2042
 
2046
2043
 
2047
- 403
2048
- 404
2049
- 405
2050
- 406</pre>
2044
+ 449
2045
+ 450
2046
+ 451
2047
+ 452</pre>
2051
2048
  </td>
2052
2049
  <td>
2053
- <pre class="code"><span class="info file"># File 'lib/mocha/expectation.rb', line 403</span>
2050
+ <pre class="code"><span class="info file"># File 'lib/mocha/expectation.rb', line 449</span>
2054
2051
 
2055
2052
  <span class='kw'>def</span> <span class='id identifier rubyid_throws'>throws</span><span class='lparen'>(</span><span class='id identifier rubyid_tag'>tag</span><span class='comma'>,</span> <span class='id identifier rubyid_object'>object</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
2056
2053
  <span class='ivar'>@return_values</span> <span class='op'>+=</span> <span class='const'>ReturnValues</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='const'>Thrower</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_tag'>tag</span><span class='comma'>,</span> <span class='id identifier rubyid_object'>object</span><span class='rparen'>)</span><span class='rparen'>)</span>
@@ -2073,8 +2070,7 @@ methods to be chained.</p>
2073
2070
  </h3><div class="docstring">
2074
2071
  <div class="discussion">
2075
2072
 
2076
- <p>Modifies expectation so that the number of calls to the expected method
2077
- must be within a specific <code>range</code>.</p>
2073
+ <p>Modifies expectation so that the number of calls to the expected method must be within a specific <code>range</code>.</p>
2078
2074
 
2079
2075
 
2080
2076
  </div>
@@ -2148,8 +2144,7 @@ must be within a specific <code>range</code>.</p>
2148
2144
 
2149
2145
  &mdash;
2150
2146
  <div class='inline'>
2151
- <p>the same expectation, thereby allowing invocations of other <span class='object_link'><a href="" title="Mocha::Expectation (class)">Mocha::Expectation</a></span>
2152
- methods to be chained.</p>
2147
+ <p>the same expectation, thereby allowing invocations of other <span class='object_link'><a href="" title="Mocha::Expectation (class)">Mocha::Expectation</a></span> methods to be chained.</p>
2153
2148
  </div>
2154
2149
 
2155
2150
  </li>
@@ -2162,13 +2157,13 @@ methods to be chained.</p>
2162
2157
  <pre class="lines">
2163
2158
 
2164
2159
 
2165
- 42
2166
- 43
2167
2160
  44
2168
- 45</pre>
2161
+ 45
2162
+ 46
2163
+ 47</pre>
2169
2164
  </td>
2170
2165
  <td>
2171
- <pre class="code"><span class="info file"># File 'lib/mocha/expectation.rb', line 42</span>
2166
+ <pre class="code"><span class="info file"># File 'lib/mocha/expectation.rb', line 44</span>
2172
2167
 
2173
2168
  <span class='kw'>def</span> <span class='id identifier rubyid_times'>times</span><span class='lparen'>(</span><span class='id identifier rubyid_range'>range</span><span class='rparen'>)</span>
2174
2169
  <span class='ivar'>@cardinality</span> <span class='op'>=</span> <span class='const'>Cardinality</span><span class='period'>.</span><span class='id identifier rubyid_times'>times</span><span class='lparen'>(</span><span class='id identifier rubyid_range'>range</span><span class='rparen'>)</span>
@@ -2191,8 +2186,7 @@ methods to be chained.</p>
2191
2186
  </h3><div class="docstring">
2192
2187
  <div class="discussion">
2193
2188
 
2194
- <p>Modifies expectation so that the expected method must be called exactly
2195
- twice.</p>
2189
+ <p>Modifies expectation so that the expected method must be called exactly twice.</p>
2196
2190
 
2197
2191
 
2198
2192
  </div>
@@ -2238,8 +2232,7 @@ twice.</p>
2238
2232
 
2239
2233
  &mdash;
2240
2234
  <div class='inline'>
2241
- <p>the same expectation, thereby allowing invocations of other <span class='object_link'><a href="" title="Mocha::Expectation (class)">Mocha::Expectation</a></span>
2242
- methods to be chained.</p>
2235
+ <p>the same expectation, thereby allowing invocations of other <span class='object_link'><a href="" title="Mocha::Expectation (class)">Mocha::Expectation</a></span> methods to be chained.</p>
2243
2236
  </div>
2244
2237
 
2245
2238
  </li>
@@ -2252,13 +2245,13 @@ methods to be chained.</p>
2252
2245
  <pre class="lines">
2253
2246
 
2254
2247
 
2255
- 68
2256
- 69
2257
2248
  70
2258
- 71</pre>
2249
+ 71
2250
+ 72
2251
+ 73</pre>
2259
2252
  </td>
2260
2253
  <td>
2261
- <pre class="code"><span class="info file"># File 'lib/mocha/expectation.rb', line 68</span>
2254
+ <pre class="code"><span class="info file"># File 'lib/mocha/expectation.rb', line 70</span>
2262
2255
 
2263
2256
  <span class='kw'>def</span> <span class='id identifier rubyid_twice'>twice</span>
2264
2257
  <span class='ivar'>@cardinality</span> <span class='op'>=</span> <span class='const'>Cardinality</span><span class='period'>.</span><span class='id identifier rubyid_exactly'>exactly</span><span class='lparen'>(</span><span class='int'>2</span><span class='rparen'>)</span>
@@ -2281,9 +2274,7 @@ methods to be chained.</p>
2281
2274
  </h3><div class="docstring">
2282
2275
  <div class="discussion">
2283
2276
 
2284
- <p>Constrains the expectation to occur only when the
2285
- <code>state_machine</code> is in the state specified by
2286
- <code>state_name</code>.</p>
2277
+ <p>Constrains the expectation to occur only when the <code>state_machine</code> is in the state specified by <code>state_name</code>.</p>
2287
2278
 
2288
2279
 
2289
2280
  </div>
@@ -2295,8 +2286,7 @@ methods to be chained.</p>
2295
2286
 
2296
2287
 
2297
2288
  <p class="example_title"><div class='inline'>
2298
- <p>Using <span class='object_link'><a href="#when-instance_method" title="Mocha::Expectation#when (method)">#when</a></span> to only allow invocation of methods when “power” state
2299
- machine is in the “on” state.</p>
2289
+ <p>Using <span class='object_link'><a href="#when-instance_method" title="Mocha::Expectation#when (method)">#when</a></span> to only allow invocation of methods when “power” state machine is in the “on” state.</p>
2300
2290
  </div></p>
2301
2291
 
2302
2292
  <pre class="example code"><code><span class='id identifier rubyid_power'>power</span> <span class='op'>=</span> <span class='id identifier rubyid_states'>states</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>power</span><span class='tstring_end'>&#39;</span></span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_starts_as'>starts_as</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>off</span><span class='tstring_end'>&#39;</span></span><span class='rparen'>)</span>
@@ -2324,9 +2314,7 @@ machine is in the “on” state.</p>
2324
2314
 
2325
2315
  &mdash;
2326
2316
  <div class='inline'>
2327
- <p>provides a mechanism to determine whether the <code>state_machine</code> is
2328
- in the state specified by <code>state_name</code> when the expected method
2329
- is invoked.</p>
2317
+ <p>provides a mechanism to determine whether the <code>state_machine</code> is in the state specified by <code>state_name</code> when the expected method is invoked.</p>
2330
2318
  </div>
2331
2319
 
2332
2320
  </li>
@@ -2345,8 +2333,7 @@ is invoked.</p>
2345
2333
 
2346
2334
  &mdash;
2347
2335
  <div class='inline'>
2348
- <p>the same expectation, thereby allowing invocations of other <span class='object_link'><a href="" title="Mocha::Expectation (class)">Mocha::Expectation</a></span>
2349
- methods to be chained.</p>
2336
+ <p>the same expectation, thereby allowing invocations of other <span class='object_link'><a href="" title="Mocha::Expectation (class)">Mocha::Expectation</a></span> methods to be chained.</p>
2350
2337
  </div>
2351
2338
 
2352
2339
  </li>
@@ -2370,13 +2357,13 @@ methods to be chained.</p>
2370
2357
  <pre class="lines">
2371
2358
 
2372
2359
 
2373
- 465
2374
- 466
2375
- 467
2376
- 468</pre>
2360
+ 511
2361
+ 512
2362
+ 513
2363
+ 514</pre>
2377
2364
  </td>
2378
2365
  <td>
2379
- <pre class="code"><span class="info file"># File 'lib/mocha/expectation.rb', line 465</span>
2366
+ <pre class="code"><span class="info file"># File 'lib/mocha/expectation.rb', line 511</span>
2380
2367
 
2381
2368
  <span class='kw'>def</span> <span class='kw'>when</span><span class='lparen'>(</span><span class='id identifier rubyid_state_predicate'>state_predicate</span><span class='rparen'>)</span>
2382
2369
  <span class='id identifier rubyid_add_ordering_constraint'>add_ordering_constraint</span><span class='lparen'>(</span><span class='const'>InStateOrderingConstraint</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_state_predicate'>state_predicate</span><span class='rparen'>)</span><span class='rparen'>)</span>
@@ -2399,8 +2386,7 @@ methods to be chained.</p>
2399
2386
  </h3><div class="docstring">
2400
2387
  <div class="discussion">
2401
2388
 
2402
- <p>Modifies expectation so that the expected method must be called with
2403
- <code>expected_parameters</code>.</p>
2389
+ <p>Modifies expectation so that the expected method must be called with <code>expected_parameters</code>.</p>
2404
2390
 
2405
2391
  <p>May be used with parameter matchers in <span class='object_link'><a href="ParameterMatchers.html" title="Mocha::ParameterMatchers (module)">ParameterMatchers</a></span>.</p>
2406
2392
 
@@ -2532,8 +2518,7 @@ methods to be chained.</p>
2532
2518
 
2533
2519
  &mdash;
2534
2520
  <div class='inline'>
2535
- <p>the same expectation, thereby allowing invocations of other <span class='object_link'><a href="" title="Mocha::Expectation (class)">Mocha::Expectation</a></span>
2536
- methods to be chained.</p>
2521
+ <p>the same expectation, thereby allowing invocations of other <span class='object_link'><a href="" title="Mocha::Expectation (class)">Mocha::Expectation</a></span> methods to be chained.</p>
2537
2522
  </div>
2538
2523
 
2539
2524
  </li>
@@ -2546,13 +2531,13 @@ methods to be chained.</p>
2546
2531
  <pre class="lines">
2547
2532
 
2548
2533
 
2549
- 221
2550
- 222
2551
2534
  223
2552
- 224</pre>
2535
+ 224
2536
+ 225
2537
+ 226</pre>
2553
2538
  </td>
2554
2539
  <td>
2555
- <pre class="code"><span class="info file"># File 'lib/mocha/expectation.rb', line 221</span>
2540
+ <pre class="code"><span class="info file"># File 'lib/mocha/expectation.rb', line 223</span>
2556
2541
 
2557
2542
  <span class='kw'>def</span> <span class='id identifier rubyid_with'>with</span><span class='lparen'>(</span><span class='op'>*</span><span class='id identifier rubyid_expected_parameters'>expected_parameters</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_matching_block'>matching_block</span><span class='rparen'>)</span>
2558
2543
  <span class='ivar'>@parameters_matcher</span> <span class='op'>=</span> <span class='const'>ParametersMatcher</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_expected_parameters'>expected_parameters</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_matching_block'>matching_block</span><span class='rparen'>)</span>
@@ -2561,6 +2546,168 @@ methods to be chained.</p>
2561
2546
  </td>
2562
2547
  </tr>
2563
2548
  </table>
2549
+ </div>
2550
+
2551
+ <div class="method_details ">
2552
+ <h3 class="signature " id="with_block_given-instance_method">
2553
+
2554
+ #<strong>with_block_given</strong> &#x21d2; <tt><span class='object_link'><a href="" title="Mocha::Expectation (class)">Expectation</a></span></tt>
2555
+
2556
+
2557
+
2558
+
2559
+
2560
+ </h3><div class="docstring">
2561
+ <div class="discussion">
2562
+
2563
+ <p>Modifies expectation so that the expected method must be called with a block.</p>
2564
+
2565
+
2566
+ </div>
2567
+ </div>
2568
+ <div class="tags">
2569
+
2570
+ <div class="examples">
2571
+ <p class="tag_title">Examples:</p>
2572
+
2573
+
2574
+ <p class="example_title"><div class='inline'>
2575
+ <p>Expected method must be called with a block.</p>
2576
+ </div></p>
2577
+
2578
+ <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>
2579
+ <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'>:expected_method</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_with_block_given'>with_block_given</span>
2580
+ <span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_expected_method'>expected_method</span> <span class='lbrace'>{</span> <span class='int'>1</span> <span class='op'>+</span> <span class='int'>1</span> <span class='rbrace'>}</span>
2581
+ <span class='comment'># =&gt; verify succeeds
2582
+ </span>
2583
+ <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>
2584
+ <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'>:expected_method</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_with_block_given'>with_block_given</span>
2585
+ <span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_expected_method'>expected_method</span>
2586
+ <span class='comment'># =&gt; verify fails</span></code></pre>
2587
+
2588
+ </div>
2589
+
2590
+ <p class="tag_title">Returns:</p>
2591
+ <ul class="return">
2592
+
2593
+ <li>
2594
+
2595
+
2596
+ <span class='type'>(<tt><span class='object_link'><a href="" title="Mocha::Expectation (class)">Expectation</a></span></tt>)</span>
2597
+
2598
+
2599
+
2600
+ &mdash;
2601
+ <div class='inline'>
2602
+ <p>the same expectation, thereby allowing invocations of other <span class='object_link'><a href="" title="Mocha::Expectation (class)">Mocha::Expectation</a></span> methods to be chained.</p>
2603
+ </div>
2604
+
2605
+ </li>
2606
+
2607
+ </ul>
2608
+
2609
+ </div><table class="source_code">
2610
+ <tr>
2611
+ <td>
2612
+ <pre class="lines">
2613
+
2614
+
2615
+ 242
2616
+ 243
2617
+ 244
2618
+ 245</pre>
2619
+ </td>
2620
+ <td>
2621
+ <pre class="code"><span class="info file"># File 'lib/mocha/expectation.rb', line 242</span>
2622
+
2623
+ <span class='kw'>def</span> <span class='id identifier rubyid_with_block_given'>with_block_given</span>
2624
+ <span class='ivar'>@block_matcher</span> <span class='op'>=</span> <span class='const'>BlockMatchers</span><span class='op'>::</span><span class='const'>BlockGiven</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span>
2625
+ <span class='kw'>self</span>
2626
+ <span class='kw'>end</span></pre>
2627
+ </td>
2628
+ </tr>
2629
+ </table>
2630
+ </div>
2631
+
2632
+ <div class="method_details ">
2633
+ <h3 class="signature " id="with_no_block_given-instance_method">
2634
+
2635
+ #<strong>with_no_block_given</strong> &#x21d2; <tt><span class='object_link'><a href="" title="Mocha::Expectation (class)">Expectation</a></span></tt>
2636
+
2637
+
2638
+
2639
+
2640
+
2641
+ </h3><div class="docstring">
2642
+ <div class="discussion">
2643
+
2644
+ <p>Modifies expectation so that the expected method must be called without a block.</p>
2645
+
2646
+
2647
+ </div>
2648
+ </div>
2649
+ <div class="tags">
2650
+
2651
+ <div class="examples">
2652
+ <p class="tag_title">Examples:</p>
2653
+
2654
+
2655
+ <p class="example_title"><div class='inline'>
2656
+ <p>Expected method must be called without a block.</p>
2657
+ </div></p>
2658
+
2659
+ <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>
2660
+ <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'>:expected_method</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_with_no_block_given'>with_no_block_given</span>
2661
+ <span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_expected_method'>expected_method</span>
2662
+ <span class='comment'># =&gt; verify succeeds
2663
+ </span>
2664
+ <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>
2665
+ <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'>:expected_method</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_with_block_given'>with_block_given</span>
2666
+ <span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_expected_method'>expected_method</span> <span class='lbrace'>{</span> <span class='int'>1</span> <span class='op'>+</span> <span class='int'>1</span> <span class='rbrace'>}</span>
2667
+ <span class='comment'># =&gt; verify fails</span></code></pre>
2668
+
2669
+ </div>
2670
+
2671
+ <p class="tag_title">Returns:</p>
2672
+ <ul class="return">
2673
+
2674
+ <li>
2675
+
2676
+
2677
+ <span class='type'>(<tt><span class='object_link'><a href="" title="Mocha::Expectation (class)">Expectation</a></span></tt>)</span>
2678
+
2679
+
2680
+
2681
+ &mdash;
2682
+ <div class='inline'>
2683
+ <p>the same expectation, thereby allowing invocations of other <span class='object_link'><a href="" title="Mocha::Expectation (class)">Mocha::Expectation</a></span> methods to be chained.</p>
2684
+ </div>
2685
+
2686
+ </li>
2687
+
2688
+ </ul>
2689
+
2690
+ </div><table class="source_code">
2691
+ <tr>
2692
+ <td>
2693
+ <pre class="lines">
2694
+
2695
+
2696
+ 261
2697
+ 262
2698
+ 263
2699
+ 264</pre>
2700
+ </td>
2701
+ <td>
2702
+ <pre class="code"><span class="info file"># File 'lib/mocha/expectation.rb', line 261</span>
2703
+
2704
+ <span class='kw'>def</span> <span class='id identifier rubyid_with_no_block_given'>with_no_block_given</span>
2705
+ <span class='ivar'>@block_matcher</span> <span class='op'>=</span> <span class='const'>BlockMatchers</span><span class='op'>::</span><span class='const'>NoBlockGiven</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span>
2706
+ <span class='kw'>self</span>
2707
+ <span class='kw'>end</span></pre>
2708
+ </td>
2709
+ </tr>
2710
+ </table>
2564
2711
  </div>
2565
2712
 
2566
2713
  <div class="method_details ">
@@ -2575,11 +2722,9 @@ methods to be chained.</p>
2575
2722
  </h3><div class="docstring">
2576
2723
  <div class="discussion">
2577
2724
 
2578
- <p>Modifies expectation so that when the expected method is called, it yields
2579
- with the specified <code>parameters</code>.</p>
2725
+ <p>Modifies expectation so that when the expected method is called, it yields with the specified <code>parameters</code> (even if no block is provided, in which case yielding will result in a <code>LocalJumpError</code>).</p>
2580
2726
 
2581
- <p>May be called multiple times on the same expectation for consecutive
2582
- invocations.</p>
2727
+ <p>May be called multiple times on the same expectation for consecutive invocations.</p>
2583
2728
 
2584
2729
 
2585
2730
  </div>
@@ -2590,29 +2735,40 @@ invocations.</p>
2590
2735
  <p class="tag_title">Examples:</p>
2591
2736
 
2592
2737
 
2738
+ <p class="example_title"><div class='inline'>
2739
+ <p>Yield when expected method is invoked.</p>
2740
+ </div></p>
2741
+
2742
+ <pre class="example code"><code><span class='id identifier rubyid_benchmark'>benchmark</span> <span class='op'>=</span> <span class='id identifier rubyid_mock'>mock</span><span class='lparen'>(</span><span class='rparen'>)</span>
2743
+ <span class='id identifier rubyid_benchmark'>benchmark</span><span class='period'>.</span><span class='id identifier rubyid_expects'>expects</span><span class='lparen'>(</span><span class='symbol'>:measure</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_yields'>yields</span><span class='period'>.</span><span class='id identifier rubyid_then'>then</span><span class='period'>.</span><span class='id identifier rubyid_returns'>returns</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>0.350000 0.400000 0.750000 ( 0.835234)</span><span class='tstring_end'>&#39;</span></span><span class='rparen'>)</span>
2744
+ <span class='id identifier rubyid_yielded'>yielded</span> <span class='op'>=</span> <span class='kw'>false</span>
2745
+ <span class='id identifier rubyid_returned_value'>returned_value</span> <span class='op'>=</span> <span class='id identifier rubyid_benchmark'>benchmark</span><span class='period'>.</span><span class='id identifier rubyid_measure'>measure</span> <span class='lbrace'>{</span> <span class='id identifier rubyid_yielded'>yielded</span> <span class='op'>=</span> <span class='kw'>true</span> <span class='rbrace'>}</span>
2746
+ <span class='id identifier rubyid_yielded'>yielded</span> <span class='comment'># =&gt; true
2747
+ </span><span class='id identifier rubyid_returned_value'>returned_value</span> <span class='comment'># =&gt; &#39;0.350000 0.400000 0.750000 ( 0.835234)&#39;</span></code></pre>
2748
+
2749
+
2593
2750
  <p class="example_title"><div class='inline'>
2594
2751
  <p>Yield parameters when expected method is invoked.</p>
2595
2752
  </div></p>
2596
2753
 
2597
- <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>
2598
- <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'>:expected_method</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_yields'>yields</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>result</span><span class='tstring_end'>&#39;</span></span><span class='rparen'>)</span>
2599
- <span class='id identifier rubyid_yielded_value'>yielded_value</span> <span class='op'>=</span> <span class='kw'>nil</span>
2600
- <span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_expected_method'>expected_method</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_value'>value</span><span class='op'>|</span> <span class='id identifier rubyid_yielded_value'>yielded_value</span> <span class='op'>=</span> <span class='id identifier rubyid_value'>value</span> <span class='rbrace'>}</span>
2601
- <span class='id identifier rubyid_yielded_value'>yielded_value</span> <span class='comment'># =&gt; &#39;result&#39;</span></code></pre>
2754
+ <pre class="example code"><code><span class='id identifier rubyid_fibonacci'>fibonacci</span> <span class='op'>=</span> <span class='id identifier rubyid_mock'>mock</span><span class='lparen'>(</span><span class='rparen'>)</span>
2755
+ <span class='id identifier rubyid_fibonacci'>fibonacci</span><span class='period'>.</span><span class='id identifier rubyid_expects'>expects</span><span class='lparen'>(</span><span class='symbol'>:next_pair</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_yields'>yields</span><span class='lparen'>(</span><span class='int'>0</span><span class='comma'>,</span> <span class='int'>1</span><span class='rparen'>)</span>
2756
+ <span class='id identifier rubyid_sum'>sum</span> <span class='op'>=</span> <span class='int'>0</span>
2757
+ <span class='id identifier rubyid_fibonacci'>fibonacci</span><span class='period'>.</span><span class='id identifier rubyid_next_pair'>next_pair</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_first'>first</span><span class='comma'>,</span> <span class='id identifier rubyid_second'>second</span><span class='op'>|</span> <span class='id identifier rubyid_sum'>sum</span> <span class='op'>=</span> <span class='id identifier rubyid_first'>first</span> <span class='op'>+</span> <span class='id identifier rubyid_second'>second</span> <span class='rbrace'>}</span>
2758
+ <span class='id identifier rubyid_sum'>sum</span> <span class='comment'># =&gt; 1</span></code></pre>
2602
2759
 
2603
2760
 
2604
2761
  <p class="example_title"><div class='inline'>
2605
2762
  <p>Yield different parameters on different invocations of the expected method.</p>
2606
2763
  </div></p>
2607
2764
 
2608
- <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>
2609
- <span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_stubs'>stubs</span><span class='lparen'>(</span><span class='symbol'>:expected_method</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_yields'>yields</span><span class='lparen'>(</span><span class='int'>1</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_then'>then</span><span class='period'>.</span><span class='id identifier rubyid_yields'>yields</span><span class='lparen'>(</span><span class='int'>2</span><span class='rparen'>)</span>
2610
- <span class='id identifier rubyid_yielded_values_from_first_invocation'>yielded_values_from_first_invocation</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
2611
- <span class='id identifier rubyid_yielded_values_from_second_invocation'>yielded_values_from_second_invocation</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
2612
- <span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_expected_method'>expected_method</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_value'>value</span><span class='op'>|</span> <span class='id identifier rubyid_yielded_values_from_first_invocation'>yielded_values_from_first_invocation</span> <span class='op'>&lt;&lt;</span> <span class='id identifier rubyid_value'>value</span> <span class='rbrace'>}</span> <span class='comment'># first invocation
2613
- </span><span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_expected_method'>expected_method</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_value'>value</span><span class='op'>|</span> <span class='id identifier rubyid_yielded_values_from_second_invocation'>yielded_values_from_second_invocation</span> <span class='op'>&lt;&lt;</span> <span class='id identifier rubyid_value'>value</span> <span class='rbrace'>}</span> <span class='comment'># second invocation
2614
- </span><span class='id identifier rubyid_yielded_values_from_first_invocation'>yielded_values_from_first_invocation</span> <span class='comment'># =&gt; [1]
2615
- </span><span class='id identifier rubyid_yielded_values_from_second_invocation'>yielded_values_from_second_invocation</span> <span class='comment'># =&gt; [2]</span></code></pre>
2765
+ <pre class="example code"><code><span class='id identifier rubyid_fibonacci'>fibonacci</span> <span class='op'>=</span> <span class='id identifier rubyid_mock'>mock</span><span class='lparen'>(</span><span class='rparen'>)</span>
2766
+ <span class='id identifier rubyid_fibonacci'>fibonacci</span><span class='period'>.</span><span class='id identifier rubyid_expects'>expects</span><span class='lparen'>(</span><span class='symbol'>:next_pair</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_yields'>yields</span><span class='lparen'>(</span><span class='int'>0</span><span class='comma'>,</span> <span class='int'>1</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_then'>then</span><span class='period'>.</span><span class='id identifier rubyid_yields'>yields</span><span class='lparen'>(</span><span class='int'>1</span><span class='comma'>,</span> <span class='int'>1</span><span class='rparen'>)</span>
2767
+ <span class='id identifier rubyid_sum'>sum</span> <span class='op'>=</span> <span class='int'>0</span>
2768
+ <span class='id identifier rubyid_fibonacci'>fibonacci</span><span class='period'>.</span><span class='id identifier rubyid_next_pair'>next_pair</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_first'>first</span><span class='comma'>,</span> <span class='id identifier rubyid_second'>second</span><span class='op'>|</span> <span class='id identifier rubyid_sum'>sum</span> <span class='op'>=</span> <span class='id identifier rubyid_first'>first</span> <span class='op'>+</span> <span class='id identifier rubyid_second'>second</span> <span class='rbrace'>}</span>
2769
+ <span class='id identifier rubyid_sum'>sum</span> <span class='comment'># =&gt; 1
2770
+ </span><span class='id identifier rubyid_fibonacci'>fibonacci</span><span class='period'>.</span><span class='id identifier rubyid_next_pair'>next_pair</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_first'>first</span><span class='comma'>,</span> <span class='id identifier rubyid_second'>second</span><span class='op'>|</span> <span class='id identifier rubyid_sum'>sum</span> <span class='op'>=</span> <span class='id identifier rubyid_first'>first</span> <span class='op'>+</span> <span class='id identifier rubyid_second'>second</span> <span class='rbrace'>}</span>
2771
+ <span class='id identifier rubyid_sum'>sum</span> <span class='comment'># =&gt; 2</span></code></pre>
2616
2772
 
2617
2773
  </div>
2618
2774
  <p class="tag_title">Parameters:</p>
@@ -2648,8 +2804,7 @@ invocations.</p>
2648
2804
 
2649
2805
  &mdash;
2650
2806
  <div class='inline'>
2651
- <p>the same expectation, thereby allowing invocations of other <span class='object_link'><a href="" title="Mocha::Expectation (class)">Mocha::Expectation</a></span>
2652
- methods to be chained.</p>
2807
+ <p>the same expectation, thereby allowing invocations of other <span class='object_link'><a href="" title="Mocha::Expectation (class)">Mocha::Expectation</a></span> methods to be chained.</p>
2653
2808
  </div>
2654
2809
 
2655
2810
  </li>
@@ -2669,17 +2824,15 @@ methods to be chained.</p>
2669
2824
  <pre class="lines">
2670
2825
 
2671
2826
 
2672
- 250
2673
- 251
2674
- 252
2675
- 253</pre>
2827
+ 297
2828
+ 298
2829
+ 299</pre>
2676
2830
  </td>
2677
2831
  <td>
2678
- <pre class="code"><span class="info file"># File 'lib/mocha/expectation.rb', line 250</span>
2832
+ <pre class="code"><span class="info file"># File 'lib/mocha/expectation.rb', line 297</span>
2679
2833
 
2680
2834
  <span class='kw'>def</span> <span class='id identifier rubyid_yields'>yields</span><span class='lparen'>(</span><span class='op'>*</span><span class='id identifier rubyid_parameters'>parameters</span><span class='rparen'>)</span>
2681
- <span class='ivar'>@yield_parameters</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span><span class='lparen'>(</span><span class='op'>*</span><span class='id identifier rubyid_parameters'>parameters</span><span class='rparen'>)</span>
2682
- <span class='kw'>self</span>
2835
+ <span class='id identifier rubyid_multiple_yields'>multiple_yields</span><span class='lparen'>(</span><span class='id identifier rubyid_parameters'>parameters</span><span class='rparen'>)</span>
2683
2836
  <span class='kw'>end</span></pre>
2684
2837
  </td>
2685
2838
  </tr>
@@ -2699,9 +2852,9 @@ methods to be chained.</p>
2699
2852
  </div>
2700
2853
 
2701
2854
  <div id="footer">
2702
- Generated on Tue Jan 15 17:13:06 2019 by
2855
+ Generated on Mon Dec 16 18:49:51 2019 by
2703
2856
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
2704
- 0.9.16 (ruby-2.5.3).
2857
+ 0.9.20 (ruby-2.6.5).
2705
2858
  </div>
2706
2859
 
2707
2860
  </div>