mocha 1.5.0 → 1.10.0

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