mocha 1.11.2 → 1.12.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CONTRIBUTING.md +1 -1
- data/README.md +28 -30
- data/RELEASE.md +25 -0
- data/Rakefile +6 -1
- data/lib/mocha/cardinality.rb +30 -27
- data/lib/mocha/expectation.rb +24 -24
- data/lib/mocha/mock.rb +1 -1
- data/lib/mocha/mockery.rb +9 -22
- data/lib/mocha/state_machine.rb +30 -38
- data/lib/mocha/version.rb +1 -1
- data/mocha.gemspec +3 -1
- metadata +5 -192
- data/docs/CNAME +0 -1
- data/docs/Mocha.html +0 -254
- data/docs/Mocha/API.html +0 -1285
- data/docs/Mocha/ClassMethods.html +0 -264
- data/docs/Mocha/Configuration.html +0 -1525
- data/docs/Mocha/Expectation.html +0 -2862
- data/docs/Mocha/ExpectationError.html +0 -152
- data/docs/Mocha/ExpectationErrorFactory.html +0 -260
- data/docs/Mocha/Hooks.html +0 -370
- data/docs/Mocha/Integration.html +0 -125
- data/docs/Mocha/Integration/MiniTest.html +0 -123
- data/docs/Mocha/Integration/MiniTest/Adapter.html +0 -164
- data/docs/Mocha/Integration/TestUnit.html +0 -123
- data/docs/Mocha/Integration/TestUnit/Adapter.html +0 -164
- data/docs/Mocha/Mock.html +0 -1210
- data/docs/Mocha/ObjectMethods.html +0 -765
- data/docs/Mocha/ParameterMatchers.html +0 -2949
- data/docs/Mocha/ParameterMatchers/AllOf.html +0 -153
- data/docs/Mocha/ParameterMatchers/AnyOf.html +0 -153
- data/docs/Mocha/ParameterMatchers/AnyParameters.html +0 -153
- data/docs/Mocha/ParameterMatchers/Anything.html +0 -153
- data/docs/Mocha/ParameterMatchers/Base.html +0 -441
- data/docs/Mocha/ParameterMatchers/Equals.html +0 -153
- data/docs/Mocha/ParameterMatchers/EquivalentUri.html +0 -153
- data/docs/Mocha/ParameterMatchers/HasEntries.html +0 -153
- data/docs/Mocha/ParameterMatchers/HasEntry.html +0 -153
- data/docs/Mocha/ParameterMatchers/HasKey.html +0 -153
- data/docs/Mocha/ParameterMatchers/HasValue.html +0 -153
- data/docs/Mocha/ParameterMatchers/Includes.html +0 -153
- data/docs/Mocha/ParameterMatchers/InstanceOf.html +0 -153
- data/docs/Mocha/ParameterMatchers/IsA.html +0 -153
- data/docs/Mocha/ParameterMatchers/KindOf.html +0 -153
- data/docs/Mocha/ParameterMatchers/Not.html +0 -153
- data/docs/Mocha/ParameterMatchers/Optionally.html +0 -153
- data/docs/Mocha/ParameterMatchers/RegexpMatches.html +0 -153
- data/docs/Mocha/ParameterMatchers/RespondsWith.html +0 -153
- data/docs/Mocha/ParameterMatchers/YamlEquivalent.html +0 -153
- data/docs/Mocha/Sequence.html +0 -149
- data/docs/Mocha/StateMachine.html +0 -527
- data/docs/Mocha/StateMachine/State.html +0 -140
- data/docs/Mocha/StateMachine/StatePredicate.html +0 -140
- data/docs/Mocha/StubbingError.html +0 -150
- data/docs/_index.html +0 -519
- data/docs/class_list.html +0 -51
- data/docs/css/common.css +0 -1
- data/docs/css/full_list.css +0 -58
- data/docs/css/style.css +0 -496
- data/docs/file.COPYING.html +0 -81
- data/docs/file.MIT-LICENSE.html +0 -85
- data/docs/file.README.html +0 -448
- data/docs/file.RELEASE.html +0 -1028
- data/docs/file_list.html +0 -71
- data/docs/frames.html +0 -17
- data/docs/index.html +0 -448
- data/docs/js/app.js +0 -303
- data/docs/js/full_list.js +0 -216
- data/docs/js/jquery.js +0 -4
- data/docs/method_list.html +0 -651
- data/docs/top-level-namespace.html +0 -118
- data/test/acceptance/acceptance_test_helper.rb +0 -42
- data/test/acceptance/bug_18914_test.rb +0 -37
- data/test/acceptance/bug_21465_test.rb +0 -31
- data/test/acceptance/bug_21563_test.rb +0 -22
- data/test/acceptance/display_matching_invocations_alongside_expectations_test.rb +0 -69
- data/test/acceptance/exception_rescue_test.rb +0 -53
- data/test/acceptance/expectations_on_multiple_methods_test.rb +0 -55
- data/test/acceptance/expected_invocation_count_test.rb +0 -229
- data/test/acceptance/failure_messages_test.rb +0 -77
- data/test/acceptance/issue_272_test.rb +0 -50
- data/test/acceptance/issue_457_test.rb +0 -31
- data/test/acceptance/issue_65_test.rb +0 -64
- data/test/acceptance/issue_70_test.rb +0 -53
- data/test/acceptance/mocha_example_test.rb +0 -106
- data/test/acceptance/mocha_test_result_test.rb +0 -83
- data/test/acceptance/mock_built_with_first_argument_type_being_string_test.rb +0 -98
- data/test/acceptance/mock_test.rb +0 -191
- data/test/acceptance/mocked_methods_dispatch_test.rb +0 -75
- data/test/acceptance/multiple_expectations_failure_message_test.rb +0 -66
- data/test/acceptance/multiple_yielding_test.rb +0 -59
- data/test/acceptance/optional_parameters_test.rb +0 -67
- data/test/acceptance/parameter_matcher_test.rb +0 -299
- data/test/acceptance/partial_mocks_test.rb +0 -44
- data/test/acceptance/prepend_test.rb +0 -86
- data/test/acceptance/prevent_use_of_mocha_outside_test_test.rb +0 -76
- data/test/acceptance/raise_exception_test.rb +0 -36
- data/test/acceptance/return_value_test.rb +0 -49
- data/test/acceptance/sequence_test.rb +0 -189
- data/test/acceptance/states_test.rb +0 -71
- data/test/acceptance/stub_any_instance_method_defined_on_superclass_test.rb +0 -64
- data/test/acceptance/stub_any_instance_method_test.rb +0 -301
- data/test/acceptance/stub_class_method_defined_on_active_record_association_proxy_test.rb +0 -105
- data/test/acceptance/stub_class_method_defined_on_class_test.rb +0 -78
- data/test/acceptance/stub_class_method_defined_on_module_test.rb +0 -73
- data/test/acceptance/stub_class_method_defined_on_superclass_test.rb +0 -144
- data/test/acceptance/stub_everything_test.rb +0 -53
- data/test/acceptance/stub_instance_method_defined_on_active_record_association_proxy_test.rb +0 -91
- data/test/acceptance/stub_instance_method_defined_on_class_and_aliased_test.rb +0 -67
- data/test/acceptance/stub_instance_method_defined_on_class_test.rb +0 -67
- data/test/acceptance/stub_instance_method_defined_on_kernel_module_test.rb +0 -136
- data/test/acceptance/stub_instance_method_defined_on_module_test.rb +0 -76
- data/test/acceptance/stub_instance_method_defined_on_object_class_test.rb +0 -75
- data/test/acceptance/stub_instance_method_defined_on_singleton_class_test.rb +0 -67
- data/test/acceptance/stub_instance_method_defined_on_superclass_test.rb +0 -70
- data/test/acceptance/stub_method_defined_on_module_and_aliased_test.rb +0 -38
- data/test/acceptance/stub_module_method_test.rb +0 -200
- data/test/acceptance/stub_test.rb +0 -49
- data/test/acceptance/stubba_example_test.rb +0 -103
- data/test/acceptance/stubba_test_result_test.rb +0 -71
- data/test/acceptance/stubbing_error_backtrace_test.rb +0 -63
- data/test/acceptance/stubbing_frozen_object_test.rb +0 -88
- data/test/acceptance/stubbing_method_accepting_block_parameter_test.rb +0 -52
- data/test/acceptance/stubbing_method_unnecessarily_test.rb +0 -63
- data/test/acceptance/stubbing_nil_test.rb +0 -60
- data/test/acceptance/stubbing_non_existent_any_instance_method_test.rb +0 -157
- data/test/acceptance/stubbing_non_existent_class_method_test.rb +0 -157
- data/test/acceptance/stubbing_non_existent_instance_method_test.rb +0 -145
- data/test/acceptance/stubbing_non_public_any_instance_method_test.rb +0 -128
- data/test/acceptance/stubbing_non_public_class_method_test.rb +0 -163
- data/test/acceptance/stubbing_non_public_instance_method_test.rb +0 -141
- data/test/acceptance/stubbing_on_non_mock_object_test.rb +0 -70
- data/test/acceptance/stubbing_same_class_method_on_parent_and_child_classes_test.rb +0 -33
- data/test/acceptance/throw_test.rb +0 -42
- data/test/acceptance/unexpected_invocation_test.rb +0 -23
- data/test/acceptance/unstubbing_test.rb +0 -194
- data/test/acceptance/yielding_test.rb +0 -80
- data/test/assertions.rb +0 -8
- data/test/deprecation_disabler.rb +0 -15
- data/test/execution_point.rb +0 -36
- data/test/integration/mini_test_test.rb +0 -8
- data/test/integration/shared_tests.rb +0 -178
- data/test/integration/test_unit_test.rb +0 -8
- data/test/method_definer.rb +0 -16
- data/test/mini_test_result.rb +0 -96
- data/test/minitest_result.rb +0 -48
- data/test/simple_counter.rb +0 -11
- data/test/test_helper.rb +0 -58
- data/test/test_runner.rb +0 -58
- data/test/test_unit_result.rb +0 -22
- data/test/unit/any_instance_method_test.rb +0 -175
- data/test/unit/array_inspect_test.rb +0 -14
- data/test/unit/backtrace_filter_test.rb +0 -17
- data/test/unit/cardinality_test.rb +0 -72
- data/test/unit/central_test.rb +0 -98
- data/test/unit/change_state_side_effect_test.rb +0 -37
- data/test/unit/class_methods_test.rb +0 -69
- data/test/unit/configuration_test.rb +0 -37
- data/test/unit/date_time_inspect_test.rb +0 -19
- data/test/unit/exception_raiser_test.rb +0 -45
- data/test/unit/expectation_list_test.rb +0 -82
- data/test/unit/expectation_test.rb +0 -504
- data/test/unit/hash_inspect_test.rb +0 -14
- data/test/unit/hooks_test.rb +0 -35
- data/test/unit/in_state_ordering_constraint_test.rb +0 -39
- data/test/unit/instance_method_test.rb +0 -282
- data/test/unit/method_matcher_test.rb +0 -26
- data/test/unit/mock_test.rb +0 -372
- data/test/unit/mockery_test.rb +0 -171
- data/test/unit/module_methods_test.rb +0 -16
- data/test/unit/object_inspect_test.rb +0 -60
- data/test/unit/object_methods_test.rb +0 -63
- data/test/unit/parameter_matchers/all_of_test.rb +0 -24
- data/test/unit/parameter_matchers/any_of_test.rb +0 -24
- data/test/unit/parameter_matchers/anything_test.rb +0 -19
- data/test/unit/parameter_matchers/equals_test.rb +0 -23
- data/test/unit/parameter_matchers/equivalent_uri_test.rb +0 -41
- data/test/unit/parameter_matchers/has_entries_test.rb +0 -51
- data/test/unit/parameter_matchers/has_entry_test.rb +0 -128
- data/test/unit/parameter_matchers/has_key_test.rb +0 -54
- data/test/unit/parameter_matchers/has_value_test.rb +0 -55
- data/test/unit/parameter_matchers/includes_test.rb +0 -106
- data/test/unit/parameter_matchers/instance_of_test.rb +0 -23
- data/test/unit/parameter_matchers/is_a_test.rb +0 -23
- data/test/unit/parameter_matchers/kind_of_test.rb +0 -23
- data/test/unit/parameter_matchers/not_test.rb +0 -24
- data/test/unit/parameter_matchers/regexp_matches_test.rb +0 -45
- data/test/unit/parameter_matchers/responds_with_test.rb +0 -38
- data/test/unit/parameter_matchers/stub_matcher.rb +0 -23
- data/test/unit/parameter_matchers/yaml_equivalent_test.rb +0 -23
- data/test/unit/parameters_matcher_test.rb +0 -119
- data/test/unit/receivers_test.rb +0 -96
- data/test/unit/return_values_test.rb +0 -66
- data/test/unit/sequence_test.rb +0 -100
- data/test/unit/single_return_value_test.rb +0 -17
- data/test/unit/state_machine_test.rb +0 -96
- data/test/unit/string_inspect_test.rb +0 -9
- data/test/unit/thrower_test.rb +0 -23
- data/test/unit/yield_parameters_test.rb +0 -73
@@ -1,2949 +0,0 @@
|
|
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
|
-
— Mocha 1.11.2
|
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> »
|
40
|
-
<span class='title'><span class='object_link'><a href="../Mocha.html" title="Mocha (module)">Mocha</a></span></span>
|
41
|
-
»
|
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) ⇒ 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) ⇒ 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> ⇒ 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> ⇒ 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) ⇒ 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) ⇒ 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) ⇒ 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) ⇒ 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) ⇒ 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) ⇒ 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) ⇒ 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) ⇒ 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) ⇒ 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) ⇒ 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) ⇒ 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) ⇒ 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) ⇒ 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) ⇒ 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) ⇒ 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) ⇒ <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<<span class='object_link'><a href="ParameterMatchers/Base.html" title="Mocha::ParameterMatchers::Base (class)">Base</a></span>></tt>)</span>
|
646
|
-
|
647
|
-
|
648
|
-
|
649
|
-
—
|
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
|
-
—
|
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) ⇒ <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<<span class='object_link'><a href="ParameterMatchers/Base.html" title="Mocha::ParameterMatchers::Base (class)">Base</a></span>></tt>)</span>
|
767
|
-
|
768
|
-
|
769
|
-
|
770
|
-
—
|
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
|
-
—
|
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> ⇒ <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
|
-
—
|
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> ⇒ <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'>'</span><span class='tstring_content'>foo</span><span class='tstring_end'>'</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
|
-
—
|
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) ⇒ <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
|
-
—
|
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
|
-
—
|
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) ⇒ <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('http://example.com/foo?a=1&b=2))
|
1137
|
-
object.method_1('http://example.com/foo?b=2&a=1')
|
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('http://example.com/foo?a=1&b=2))
|
1147
|
-
object.method_1('http://example.com/foo?a=1&b=3')
|
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
|
-
—
|
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
|
-
—
|
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) ⇒ <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
|
-
|
1234
|
-
</div>
|
1235
|
-
</div>
|
1236
|
-
<div class="tags">
|
1237
|
-
|
1238
|
-
<div class="examples">
|
1239
|
-
<p class="tag_title">Examples:</p>
|
1240
|
-
|
1241
|
-
|
1242
|
-
<p class="example_title"><div class='inline'>
|
1243
|
-
<p>Actual parameter contains all expected entries.</p>
|
1244
|
-
</div></p>
|
1245
|
-
|
1246
|
-
<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>
|
1247
|
-
<span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_expects'>expects</span><span class='lparen'>(</span><span class='symbol'>:method_1</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_with'>with</span><span class='lparen'>(</span><span class='id identifier rubyid_has_entries'>has_entries</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>key_1</span><span class='tstring_end'>'</span></span> <span class='op'>=></span> <span class='int'>1</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>key_2</span><span class='tstring_end'>'</span></span> <span class='op'>=></span> <span class='int'>2</span><span class='rparen'>)</span><span class='rparen'>)</span>
|
1248
|
-
<span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_method_1'>method_1</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>key_1</span><span class='tstring_end'>'</span></span> <span class='op'>=></span> <span class='int'>1</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>key_2</span><span class='tstring_end'>'</span></span> <span class='op'>=></span> <span class='int'>2</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>key_3</span><span class='tstring_end'>'</span></span> <span class='op'>=></span> <span class='int'>3</span><span class='rparen'>)</span>
|
1249
|
-
<span class='comment'># no error raised</span></code></pre>
|
1250
|
-
|
1251
|
-
|
1252
|
-
<p class="example_title"><div class='inline'>
|
1253
|
-
<p>Actual parameter does not contain all expected entries.</p>
|
1254
|
-
</div></p>
|
1255
|
-
|
1256
|
-
<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>
|
1257
|
-
<span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_expects'>expects</span><span class='lparen'>(</span><span class='symbol'>:method_1</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_with'>with</span><span class='lparen'>(</span><span class='id identifier rubyid_has_entries'>has_entries</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>key_1</span><span class='tstring_end'>'</span></span> <span class='op'>=></span> <span class='int'>1</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>key_2</span><span class='tstring_end'>'</span></span> <span class='op'>=></span> <span class='int'>2</span><span class='rparen'>)</span><span class='rparen'>)</span>
|
1258
|
-
<span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_method_1'>method_1</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>key_1</span><span class='tstring_end'>'</span></span> <span class='op'>=></span> <span class='int'>1</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>key_2</span><span class='tstring_end'>'</span></span> <span class='op'>=></span> <span class='int'>99</span><span class='rparen'>)</span>
|
1259
|
-
<span class='comment'># error raised, because method_1 was not called with Hash containing entries: 'key_1' => 1, 'key_2' => 2</span></code></pre>
|
1260
|
-
|
1261
|
-
</div>
|
1262
|
-
<p class="tag_title">Parameters:</p>
|
1263
|
-
<ul class="param">
|
1264
|
-
|
1265
|
-
<li>
|
1266
|
-
|
1267
|
-
<span class='name'>entries</span>
|
1268
|
-
|
1269
|
-
|
1270
|
-
<span class='type'>(<tt>Hash</tt>)</span>
|
1271
|
-
|
1272
|
-
|
1273
|
-
|
1274
|
-
—
|
1275
|
-
<div class='inline'>
|
1276
|
-
<p>expected <code>Hash</code> entries.</p>
|
1277
|
-
</div>
|
1278
|
-
|
1279
|
-
</li>
|
1280
|
-
|
1281
|
-
</ul>
|
1282
|
-
|
1283
|
-
<p class="tag_title">Returns:</p>
|
1284
|
-
<ul class="return">
|
1285
|
-
|
1286
|
-
<li>
|
1287
|
-
|
1288
|
-
|
1289
|
-
<span class='type'>(<tt><span class='object_link'><a href="ParameterMatchers/HasEntries.html" title="Mocha::ParameterMatchers::HasEntries (class)">HasEntries</a></span></tt>)</span>
|
1290
|
-
|
1291
|
-
|
1292
|
-
|
1293
|
-
—
|
1294
|
-
<div class='inline'>
|
1295
|
-
<p>parameter matcher.</p>
|
1296
|
-
</div>
|
1297
|
-
|
1298
|
-
</li>
|
1299
|
-
|
1300
|
-
</ul>
|
1301
|
-
|
1302
|
-
<p class="tag_title">See Also:</p>
|
1303
|
-
<ul class="see">
|
1304
|
-
|
1305
|
-
<li><span class='object_link'><a href="Expectation.html#with-instance_method" title="Mocha::Expectation#with (method)">Expectation#with</a></span></li>
|
1306
|
-
|
1307
|
-
</ul>
|
1308
|
-
|
1309
|
-
</div><table class="source_code">
|
1310
|
-
<tr>
|
1311
|
-
<td>
|
1312
|
-
<pre class="lines">
|
1313
|
-
|
1314
|
-
|
1315
|
-
26
|
1316
|
-
27
|
1317
|
-
28</pre>
|
1318
|
-
</td>
|
1319
|
-
<td>
|
1320
|
-
<pre class="code"><span class="info file"># File 'lib/mocha/parameter_matchers/has_entries.rb', line 26</span>
|
1321
|
-
|
1322
|
-
<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> <span class='comment'># rubocop:disable Naming/PredicateName
|
1323
|
-
</span> <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>
|
1324
|
-
<span class='kw'>end</span></pre>
|
1325
|
-
</td>
|
1326
|
-
</tr>
|
1327
|
-
</table>
|
1328
|
-
</div>
|
1329
|
-
|
1330
|
-
<div class="method_details ">
|
1331
|
-
<h3 class="signature " id="has_entry-instance_method">
|
1332
|
-
|
1333
|
-
|
1334
|
-
<span class="overload">#<strong>has_entry</strong>(key, value) ⇒ <tt><span class='object_link'><a href="ParameterMatchers/HasEntry.html" title="Mocha::ParameterMatchers::HasEntry (class)">HasEntry</a></span></tt> </span>
|
1335
|
-
|
1336
|
-
<span class="overload">#<strong>has_entry</strong>(single_entry_hash) ⇒ <tt><span class='object_link'><a href="ParameterMatchers/HasEntry.html" title="Mocha::ParameterMatchers::HasEntry (class)">HasEntry</a></span></tt> </span>
|
1337
|
-
|
1338
|
-
|
1339
|
-
|
1340
|
-
|
1341
|
-
|
1342
|
-
|
1343
|
-
</h3><div class="docstring">
|
1344
|
-
<div class="discussion">
|
1345
|
-
|
1346
|
-
<p>Matches <code>Hash</code> containing entry with <code>key</code> and <code>value</code>.</p>
|
1347
|
-
|
1348
|
-
|
1349
|
-
</div>
|
1350
|
-
</div>
|
1351
|
-
<div class="tags">
|
1352
|
-
|
1353
|
-
<div class="examples">
|
1354
|
-
<p class="tag_title">Examples:</p>
|
1355
|
-
|
1356
|
-
|
1357
|
-
<p class="example_title"><div class='inline'>
|
1358
|
-
<p>Actual parameter contains expected entry supplied as key and value.</p>
|
1359
|
-
</div></p>
|
1360
|
-
|
1361
|
-
<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>
|
1362
|
-
<span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_expects'>expects</span><span class='lparen'>(</span><span class='symbol'>:method_1</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_with'>with</span><span class='lparen'>(</span><span class='id identifier rubyid_has_entry'>has_entry</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>key_1</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='int'>1</span><span class='rparen'>)</span><span class='rparen'>)</span>
|
1363
|
-
<span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_method_1'>method_1</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>key_1</span><span class='tstring_end'>'</span></span> <span class='op'>=></span> <span class='int'>1</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>key_2</span><span class='tstring_end'>'</span></span> <span class='op'>=></span> <span class='int'>2</span><span class='rparen'>)</span>
|
1364
|
-
<span class='comment'># no error raised</span></code></pre>
|
1365
|
-
|
1366
|
-
|
1367
|
-
<p class="example_title"><div class='inline'>
|
1368
|
-
<p>Actual parameter contains expected entry supplied as <code>Hash</code> entry.</p>
|
1369
|
-
</div></p>
|
1370
|
-
|
1371
|
-
<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>
|
1372
|
-
<span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_expects'>expects</span><span class='lparen'>(</span><span class='symbol'>:method_1</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_with'>with</span><span class='lparen'>(</span><span class='id identifier rubyid_has_entry'>has_entry</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>key_1</span><span class='tstring_end'>'</span></span> <span class='op'>=></span> <span class='int'>1</span><span class='rparen'>)</span><span class='rparen'>)</span>
|
1373
|
-
<span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_method_1'>method_1</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>key_1</span><span class='tstring_end'>'</span></span> <span class='op'>=></span> <span class='int'>1</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>key_2</span><span class='tstring_end'>'</span></span> <span class='op'>=></span> <span class='int'>2</span><span class='rparen'>)</span>
|
1374
|
-
<span class='comment'># no error raised</span></code></pre>
|
1375
|
-
|
1376
|
-
|
1377
|
-
<p class="example_title"><div class='inline'>
|
1378
|
-
<p>Actual parameter does not contain expected entry supplied as key and value.</p>
|
1379
|
-
</div></p>
|
1380
|
-
|
1381
|
-
<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>
|
1382
|
-
<span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_expects'>expects</span><span class='lparen'>(</span><span class='symbol'>:method_1</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_with'>with</span><span class='lparen'>(</span><span class='id identifier rubyid_has_entry'>has_entry</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>key_1</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='int'>1</span><span class='rparen'>)</span><span class='rparen'>)</span>
|
1383
|
-
<span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_method_1'>method_1</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>key_1</span><span class='tstring_end'>'</span></span> <span class='op'>=></span> <span class='int'>2</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>key_2</span><span class='tstring_end'>'</span></span> <span class='op'>=></span> <span class='int'>1</span><span class='rparen'>)</span>
|
1384
|
-
<span class='comment'># error raised, because method_1 was not called with Hash containing entry: 'key_1' => 1</span></code></pre>
|
1385
|
-
|
1386
|
-
|
1387
|
-
<p class="example_title"><div class='inline'>
|
1388
|
-
<p>Actual parameter does not contain expected entry supplied as <code>Hash</code> entry.</p>
|
1389
|
-
</div></p>
|
1390
|
-
|
1391
|
-
<pre class="example code"><code>
|
1392
|
-
<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>
|
1393
|
-
<span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_expects'>expects</span><span class='lparen'>(</span><span class='symbol'>:method_1</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_with'>with</span><span class='lparen'>(</span><span class='id identifier rubyid_has_entry'>has_entry</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>key_1</span><span class='tstring_end'>'</span></span> <span class='op'>=></span> <span class='int'>1</span><span class='rparen'>)</span><span class='rparen'>)</span>
|
1394
|
-
<span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_method_1'>method_1</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>key_1</span><span class='tstring_end'>'</span></span> <span class='op'>=></span> <span class='int'>2</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>key_2</span><span class='tstring_end'>'</span></span> <span class='op'>=></span> <span class='int'>1</span><span class='rparen'>)</span>
|
1395
|
-
<span class='comment'># error raised, because method_1 was not called with Hash containing entry: 'key_1' => 1</span></code></pre>
|
1396
|
-
|
1397
|
-
</div>
|
1398
|
-
|
1399
|
-
<p class="tag_title">Overloads:</p>
|
1400
|
-
<ul class="overload">
|
1401
|
-
|
1402
|
-
|
1403
|
-
<li class="overload_item">
|
1404
|
-
<span class="signature">#<strong>has_entry</strong>(key, value) ⇒ <tt><span class='object_link'><a href="ParameterMatchers/HasEntry.html" title="Mocha::ParameterMatchers::HasEntry (class)">HasEntry</a></span></tt> </span>
|
1405
|
-
<div class="docstring">
|
1406
|
-
<div class="discussion">
|
1407
|
-
|
1408
|
-
|
1409
|
-
</div>
|
1410
|
-
</div>
|
1411
|
-
<div class="tags">
|
1412
|
-
<p class="tag_title">Parameters:</p>
|
1413
|
-
<ul class="param">
|
1414
|
-
|
1415
|
-
<li>
|
1416
|
-
|
1417
|
-
<span class='name'>key</span>
|
1418
|
-
|
1419
|
-
|
1420
|
-
<span class='type'>(<tt><span class='object_link'>Object</span></tt>)</span>
|
1421
|
-
|
1422
|
-
|
1423
|
-
|
1424
|
-
—
|
1425
|
-
<div class='inline'>
|
1426
|
-
<p>key for entry.</p>
|
1427
|
-
</div>
|
1428
|
-
|
1429
|
-
</li>
|
1430
|
-
|
1431
|
-
<li>
|
1432
|
-
|
1433
|
-
<span class='name'>value</span>
|
1434
|
-
|
1435
|
-
|
1436
|
-
<span class='type'>(<tt><span class='object_link'>Object</span></tt>)</span>
|
1437
|
-
|
1438
|
-
|
1439
|
-
|
1440
|
-
—
|
1441
|
-
<div class='inline'>
|
1442
|
-
<p>value for entry.</p>
|
1443
|
-
</div>
|
1444
|
-
|
1445
|
-
</li>
|
1446
|
-
|
1447
|
-
</ul>
|
1448
|
-
|
1449
|
-
|
1450
|
-
</div>
|
1451
|
-
</li>
|
1452
|
-
|
1453
|
-
|
1454
|
-
<li class="overload_item">
|
1455
|
-
<span class="signature">#<strong>has_entry</strong>(single_entry_hash) ⇒ <tt><span class='object_link'><a href="ParameterMatchers/HasEntry.html" title="Mocha::ParameterMatchers::HasEntry (class)">HasEntry</a></span></tt> </span>
|
1456
|
-
<div class="docstring">
|
1457
|
-
<div class="discussion">
|
1458
|
-
|
1459
|
-
|
1460
|
-
</div>
|
1461
|
-
</div>
|
1462
|
-
<div class="tags">
|
1463
|
-
<p class="tag_title">Parameters:</p>
|
1464
|
-
<ul class="param">
|
1465
|
-
|
1466
|
-
<li>
|
1467
|
-
|
1468
|
-
<span class='name'>single_entry_hash</span>
|
1469
|
-
|
1470
|
-
|
1471
|
-
<span class='type'>(<tt>Hash</tt>)</span>
|
1472
|
-
|
1473
|
-
|
1474
|
-
|
1475
|
-
—
|
1476
|
-
<div class='inline'>
|
1477
|
-
<p><code>Hash</code> with single entry.</p>
|
1478
|
-
</div>
|
1479
|
-
|
1480
|
-
</li>
|
1481
|
-
|
1482
|
-
</ul>
|
1483
|
-
|
1484
|
-
<p class="tag_title">Raises:</p>
|
1485
|
-
<ul class="raise">
|
1486
|
-
|
1487
|
-
<li>
|
1488
|
-
|
1489
|
-
|
1490
|
-
<span class='type'>(<tt>ArgumentError</tt>)</span>
|
1491
|
-
|
1492
|
-
|
1493
|
-
|
1494
|
-
—
|
1495
|
-
<div class='inline'>
|
1496
|
-
<p>if <code>single_entry_hash</code> does not contain exactly one entry.</p>
|
1497
|
-
</div>
|
1498
|
-
|
1499
|
-
</li>
|
1500
|
-
|
1501
|
-
</ul>
|
1502
|
-
|
1503
|
-
</div>
|
1504
|
-
</li>
|
1505
|
-
|
1506
|
-
</ul>
|
1507
|
-
|
1508
|
-
<p class="tag_title">Returns:</p>
|
1509
|
-
<ul class="return">
|
1510
|
-
|
1511
|
-
<li>
|
1512
|
-
|
1513
|
-
|
1514
|
-
<span class='type'>(<tt><span class='object_link'><a href="ParameterMatchers/HasEntry.html" title="Mocha::ParameterMatchers::HasEntry (class)">HasEntry</a></span></tt>)</span>
|
1515
|
-
|
1516
|
-
|
1517
|
-
|
1518
|
-
—
|
1519
|
-
<div class='inline'>
|
1520
|
-
<p>parameter matcher.</p>
|
1521
|
-
</div>
|
1522
|
-
|
1523
|
-
</li>
|
1524
|
-
|
1525
|
-
</ul>
|
1526
|
-
|
1527
|
-
<p class="tag_title">See Also:</p>
|
1528
|
-
<ul class="see">
|
1529
|
-
|
1530
|
-
<li><span class='object_link'><a href="Expectation.html#with-instance_method" title="Mocha::Expectation#with (method)">Expectation#with</a></span></li>
|
1531
|
-
|
1532
|
-
</ul>
|
1533
|
-
|
1534
|
-
</div><table class="source_code">
|
1535
|
-
<tr>
|
1536
|
-
<td>
|
1537
|
-
<pre class="lines">
|
1538
|
-
|
1539
|
-
|
1540
|
-
43
|
1541
|
-
44
|
1542
|
-
45
|
1543
|
-
46
|
1544
|
-
47
|
1545
|
-
48
|
1546
|
-
49
|
1547
|
-
50
|
1548
|
-
51
|
1549
|
-
52
|
1550
|
-
53
|
1551
|
-
54
|
1552
|
-
55
|
1553
|
-
56
|
1554
|
-
57
|
1555
|
-
58
|
1556
|
-
59
|
1557
|
-
60
|
1558
|
-
61
|
1559
|
-
62
|
1560
|
-
63
|
1561
|
-
64
|
1562
|
-
65</pre>
|
1563
|
-
</td>
|
1564
|
-
<td>
|
1565
|
-
<pre class="code"><span class="info file"># File 'lib/mocha/parameter_matchers/has_entry.rb', line 43</span>
|
1566
|
-
|
1567
|
-
<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> <span class='comment'># rubocop:disable Naming/PredicateName
|
1568
|
-
</span> <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>
|
1569
|
-
<span class='kw'>when</span> <span class='int'>1</span>
|
1570
|
-
<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>
|
1571
|
-
<span class='kw'>when</span> <span class='const'>Hash</span>
|
1572
|
-
<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>
|
1573
|
-
<span class='kw'>when</span> <span class='int'>0</span>
|
1574
|
-
<span class='id identifier rubyid_raise'>raise</span> <span class='const'>ArgumentError</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>Argument has no entries.</span><span class='tstring_end'>'</span></span>
|
1575
|
-
<span class='kw'>when</span> <span class='int'>1</span>
|
1576
|
-
<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>
|
1577
|
-
<span class='kw'>else</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'>'</span><span class='tstring_content'>Argument has multiple entries. Use Mocha::ParameterMatchers#has_entries instead.</span><span class='tstring_end'>'</span></span>
|
1579
|
-
<span class='kw'>end</span>
|
1580
|
-
<span class='kw'>else</span>
|
1581
|
-
<span class='id identifier rubyid_raise'>raise</span> <span class='const'>ArgumentError</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>Argument is not a Hash.</span><span class='tstring_end'>'</span></span>
|
1582
|
-
<span class='kw'>end</span>
|
1583
|
-
<span class='kw'>when</span> <span class='int'>2</span>
|
1584
|
-
<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>
|
1585
|
-
<span class='kw'>else</span>
|
1586
|
-
<span class='id identifier rubyid_raise'>raise</span> <span class='const'>ArgumentError</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</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'>'</span></span>
|
1587
|
-
<span class='kw'>end</span>
|
1588
|
-
<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>
|
1589
|
-
<span class='kw'>end</span></pre>
|
1590
|
-
</td>
|
1591
|
-
</tr>
|
1592
|
-
</table>
|
1593
|
-
</div>
|
1594
|
-
|
1595
|
-
<div class="method_details ">
|
1596
|
-
<h3 class="signature " id="has_key-instance_method">
|
1597
|
-
|
1598
|
-
#<strong>has_key</strong>(key) ⇒ <tt><span class='object_link'><a href="ParameterMatchers/HasKey.html" title="Mocha::ParameterMatchers::HasKey (class)">HasKey</a></span></tt>
|
1599
|
-
|
1600
|
-
|
1601
|
-
|
1602
|
-
|
1603
|
-
|
1604
|
-
</h3><div class="docstring">
|
1605
|
-
<div class="discussion">
|
1606
|
-
|
1607
|
-
<p>Matches <code>Hash</code> containing <code>key</code>.</p>
|
1608
|
-
|
1609
|
-
|
1610
|
-
</div>
|
1611
|
-
</div>
|
1612
|
-
<div class="tags">
|
1613
|
-
|
1614
|
-
<div class="examples">
|
1615
|
-
<p class="tag_title">Examples:</p>
|
1616
|
-
|
1617
|
-
|
1618
|
-
<p class="example_title"><div class='inline'>
|
1619
|
-
<p>Actual parameter contains entry with expected key.</p>
|
1620
|
-
</div></p>
|
1621
|
-
|
1622
|
-
<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>
|
1623
|
-
<span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_expects'>expects</span><span class='lparen'>(</span><span class='symbol'>:method_1</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_with'>with</span><span class='lparen'>(</span><span class='id identifier rubyid_has_key'>has_key</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>key_1</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span><span class='rparen'>)</span>
|
1624
|
-
<span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_method_1'>method_1</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>key_1</span><span class='tstring_end'>'</span></span> <span class='op'>=></span> <span class='int'>1</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>key_2</span><span class='tstring_end'>'</span></span> <span class='op'>=></span> <span class='int'>2</span><span class='rparen'>)</span>
|
1625
|
-
<span class='comment'># no error raised</span></code></pre>
|
1626
|
-
|
1627
|
-
|
1628
|
-
<p class="example_title"><div class='inline'>
|
1629
|
-
<p>Actual parameter does not contain entry with expected key.</p>
|
1630
|
-
</div></p>
|
1631
|
-
|
1632
|
-
<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>
|
1633
|
-
<span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_expects'>expects</span><span class='lparen'>(</span><span class='symbol'>:method_1</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_with'>with</span><span class='lparen'>(</span><span class='id identifier rubyid_has_key'>has_key</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>key_1</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span><span class='rparen'>)</span>
|
1634
|
-
<span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_method_1'>method_1</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>key_2</span><span class='tstring_end'>'</span></span> <span class='op'>=></span> <span class='int'>2</span><span class='rparen'>)</span>
|
1635
|
-
<span class='comment'># error raised, because method_1 was not called with Hash containing key: 'key_1'</span></code></pre>
|
1636
|
-
|
1637
|
-
</div>
|
1638
|
-
<p class="tag_title">Parameters:</p>
|
1639
|
-
<ul class="param">
|
1640
|
-
|
1641
|
-
<li>
|
1642
|
-
|
1643
|
-
<span class='name'>key</span>
|
1644
|
-
|
1645
|
-
|
1646
|
-
<span class='type'>(<tt><span class='object_link'>Object</span></tt>)</span>
|
1647
|
-
|
1648
|
-
|
1649
|
-
|
1650
|
-
—
|
1651
|
-
<div class='inline'>
|
1652
|
-
<p>expected key.</p>
|
1653
|
-
</div>
|
1654
|
-
|
1655
|
-
</li>
|
1656
|
-
|
1657
|
-
</ul>
|
1658
|
-
|
1659
|
-
<p class="tag_title">Returns:</p>
|
1660
|
-
<ul class="return">
|
1661
|
-
|
1662
|
-
<li>
|
1663
|
-
|
1664
|
-
|
1665
|
-
<span class='type'>(<tt><span class='object_link'><a href="ParameterMatchers/HasKey.html" title="Mocha::ParameterMatchers::HasKey (class)">HasKey</a></span></tt>)</span>
|
1666
|
-
|
1667
|
-
|
1668
|
-
|
1669
|
-
—
|
1670
|
-
<div class='inline'>
|
1671
|
-
<p>parameter matcher.</p>
|
1672
|
-
</div>
|
1673
|
-
|
1674
|
-
</li>
|
1675
|
-
|
1676
|
-
</ul>
|
1677
|
-
|
1678
|
-
<p class="tag_title">See Also:</p>
|
1679
|
-
<ul class="see">
|
1680
|
-
|
1681
|
-
<li><span class='object_link'><a href="Expectation.html#with-instance_method" title="Mocha::Expectation#with (method)">Expectation#with</a></span></li>
|
1682
|
-
|
1683
|
-
</ul>
|
1684
|
-
|
1685
|
-
</div><table class="source_code">
|
1686
|
-
<tr>
|
1687
|
-
<td>
|
1688
|
-
<pre class="lines">
|
1689
|
-
|
1690
|
-
|
1691
|
-
24
|
1692
|
-
25
|
1693
|
-
26</pre>
|
1694
|
-
</td>
|
1695
|
-
<td>
|
1696
|
-
<pre class="code"><span class="info file"># File 'lib/mocha/parameter_matchers/has_key.rb', line 24</span>
|
1697
|
-
|
1698
|
-
<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> <span class='comment'># rubocop:disable Naming/PredicateName
|
1699
|
-
</span> <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>
|
1700
|
-
<span class='kw'>end</span></pre>
|
1701
|
-
</td>
|
1702
|
-
</tr>
|
1703
|
-
</table>
|
1704
|
-
</div>
|
1705
|
-
|
1706
|
-
<div class="method_details ">
|
1707
|
-
<h3 class="signature " id="has_value-instance_method">
|
1708
|
-
|
1709
|
-
#<strong>has_value</strong>(value) ⇒ <tt><span class='object_link'><a href="ParameterMatchers/HasValue.html" title="Mocha::ParameterMatchers::HasValue (class)">HasValue</a></span></tt>
|
1710
|
-
|
1711
|
-
|
1712
|
-
|
1713
|
-
|
1714
|
-
|
1715
|
-
</h3><div class="docstring">
|
1716
|
-
<div class="discussion">
|
1717
|
-
|
1718
|
-
<p>Matches <code>Hash</code> containing <code>value</code>.</p>
|
1719
|
-
|
1720
|
-
|
1721
|
-
</div>
|
1722
|
-
</div>
|
1723
|
-
<div class="tags">
|
1724
|
-
|
1725
|
-
<div class="examples">
|
1726
|
-
<p class="tag_title">Examples:</p>
|
1727
|
-
|
1728
|
-
|
1729
|
-
<p class="example_title"><div class='inline'>
|
1730
|
-
<p>Actual parameter contains entry with expected value.</p>
|
1731
|
-
</div></p>
|
1732
|
-
|
1733
|
-
<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>
|
1734
|
-
<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>
|
1735
|
-
<span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_method_1'>method_1</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>key_1</span><span class='tstring_end'>'</span></span> <span class='op'>=></span> <span class='int'>1</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>key_2</span><span class='tstring_end'>'</span></span> <span class='op'>=></span> <span class='int'>2</span><span class='rparen'>)</span>
|
1736
|
-
<span class='comment'># no error raised</span></code></pre>
|
1737
|
-
|
1738
|
-
|
1739
|
-
<p class="example_title"><div class='inline'>
|
1740
|
-
<p>Actual parameter does not contain entry with expected value.</p>
|
1741
|
-
</div></p>
|
1742
|
-
|
1743
|
-
<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>
|
1744
|
-
<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>
|
1745
|
-
<span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_method_1'>method_1</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>key_2</span><span class='tstring_end'>'</span></span> <span class='op'>=></span> <span class='int'>2</span><span class='rparen'>)</span>
|
1746
|
-
<span class='comment'># error raised, because method_1 was not called with Hash containing value: 1</span></code></pre>
|
1747
|
-
|
1748
|
-
</div>
|
1749
|
-
<p class="tag_title">Parameters:</p>
|
1750
|
-
<ul class="param">
|
1751
|
-
|
1752
|
-
<li>
|
1753
|
-
|
1754
|
-
<span class='name'>value</span>
|
1755
|
-
|
1756
|
-
|
1757
|
-
<span class='type'>(<tt><span class='object_link'>Object</span></tt>)</span>
|
1758
|
-
|
1759
|
-
|
1760
|
-
|
1761
|
-
—
|
1762
|
-
<div class='inline'>
|
1763
|
-
<p>expected value.</p>
|
1764
|
-
</div>
|
1765
|
-
|
1766
|
-
</li>
|
1767
|
-
|
1768
|
-
</ul>
|
1769
|
-
|
1770
|
-
<p class="tag_title">Returns:</p>
|
1771
|
-
<ul class="return">
|
1772
|
-
|
1773
|
-
<li>
|
1774
|
-
|
1775
|
-
|
1776
|
-
<span class='type'>(<tt><span class='object_link'><a href="ParameterMatchers/HasValue.html" title="Mocha::ParameterMatchers::HasValue (class)">HasValue</a></span></tt>)</span>
|
1777
|
-
|
1778
|
-
|
1779
|
-
|
1780
|
-
—
|
1781
|
-
<div class='inline'>
|
1782
|
-
<p>parameter matcher.</p>
|
1783
|
-
</div>
|
1784
|
-
|
1785
|
-
</li>
|
1786
|
-
|
1787
|
-
</ul>
|
1788
|
-
|
1789
|
-
<p class="tag_title">See Also:</p>
|
1790
|
-
<ul class="see">
|
1791
|
-
|
1792
|
-
<li><span class='object_link'><a href="Expectation.html#with-instance_method" title="Mocha::Expectation#with (method)">Expectation#with</a></span></li>
|
1793
|
-
|
1794
|
-
</ul>
|
1795
|
-
|
1796
|
-
</div><table class="source_code">
|
1797
|
-
<tr>
|
1798
|
-
<td>
|
1799
|
-
<pre class="lines">
|
1800
|
-
|
1801
|
-
|
1802
|
-
24
|
1803
|
-
25
|
1804
|
-
26</pre>
|
1805
|
-
</td>
|
1806
|
-
<td>
|
1807
|
-
<pre class="code"><span class="info file"># File 'lib/mocha/parameter_matchers/has_value.rb', line 24</span>
|
1808
|
-
|
1809
|
-
<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> <span class='comment'># rubocop:disable Naming/PredicateName
|
1810
|
-
</span> <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>
|
1811
|
-
<span class='kw'>end</span></pre>
|
1812
|
-
</td>
|
1813
|
-
</tr>
|
1814
|
-
</table>
|
1815
|
-
</div>
|
1816
|
-
|
1817
|
-
<div class="method_details ">
|
1818
|
-
<h3 class="signature " id="includes-instance_method">
|
1819
|
-
|
1820
|
-
#<strong>includes</strong>(*items) ⇒ <tt><span class='object_link'><a href="ParameterMatchers/Includes.html" title="Mocha::ParameterMatchers::Includes (class)">Includes</a></span></tt>
|
1821
|
-
|
1822
|
-
|
1823
|
-
|
1824
|
-
|
1825
|
-
|
1826
|
-
</h3><div class="docstring">
|
1827
|
-
<div class="discussion">
|
1828
|
-
|
1829
|
-
<p>Matches any object that responds with <code>true</code> to <tt>include?(item)</tt> for all items.</p>
|
1830
|
-
|
1831
|
-
|
1832
|
-
</div>
|
1833
|
-
</div>
|
1834
|
-
<div class="tags">
|
1835
|
-
|
1836
|
-
<div class="examples">
|
1837
|
-
<p class="tag_title">Examples:</p>
|
1838
|
-
|
1839
|
-
|
1840
|
-
<p class="example_title"><div class='inline'>
|
1841
|
-
<p>Actual parameter includes all items.</p>
|
1842
|
-
</div></p>
|
1843
|
-
|
1844
|
-
<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>
|
1845
|
-
<span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_expects'>expects</span><span class='lparen'>(</span><span class='symbol'>:method_1</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_with'>with</span><span class='lparen'>(</span><span class='id identifier rubyid_includes'>includes</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>foo</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>bar</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span><span class='rparen'>)</span>
|
1846
|
-
<span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_method_1'>method_1</span><span class='lparen'>(</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>foo</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>bar</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>baz</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='rparen'>)</span>
|
1847
|
-
<span class='comment'># no error raised</span></code></pre>
|
1848
|
-
|
1849
|
-
|
1850
|
-
<p class="example_title"><div class='inline'>
|
1851
|
-
<p>Actual parameter does not include all items.</p>
|
1852
|
-
</div></p>
|
1853
|
-
|
1854
|
-
<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'>'</span><span class='tstring_content'>foo</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>baz</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='rparen'>)</span>
|
1855
|
-
<span class='comment'># error raised, because ['foo', 'baz'] does not include 'bar'.</span></code></pre>
|
1856
|
-
|
1857
|
-
|
1858
|
-
<p class="example_title"><div class='inline'>
|
1859
|
-
<p>Actual parameter includes item which matches nested matcher.</p>
|
1860
|
-
</div></p>
|
1861
|
-
|
1862
|
-
<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>
|
1863
|
-
<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>
|
1864
|
-
<span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_method_1'>method_1</span><span class='lparen'>(</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>foo</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>bar</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='lbrace'>{</span><span class='symbol'>:key</span> <span class='op'>=></span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>baz</span><span class='tstring_end'>'</span></span><span class='rbrace'>}</span><span class='rbracket'>]</span><span class='rparen'>)</span>
|
1865
|
-
<span class='comment'># no error raised</span></code></pre>
|
1866
|
-
|
1867
|
-
|
1868
|
-
<p class="example_title"><div class='inline'>
|
1869
|
-
<p>Actual parameter does not include item matching nested matcher.</p>
|
1870
|
-
</div></p>
|
1871
|
-
|
1872
|
-
<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'>'</span><span class='tstring_content'>foo</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>bar</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='lbrace'>{</span><span class='symbol'>:other_key</span> <span class='op'>=></span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>baz</span><span class='tstring_end'>'</span></span><span class='rbrace'>}</span><span class='rbracket'>]</span><span class='rparen'>)</span>
|
1873
|
-
<span class='comment'># error raised, because no element matches `has_key(:key)` matcher</span></code></pre>
|
1874
|
-
|
1875
|
-
|
1876
|
-
<p class="example_title"><div class='inline'>
|
1877
|
-
<p>Actual parameter is a String including substring.</p>
|
1878
|
-
</div></p>
|
1879
|
-
|
1880
|
-
<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>
|
1881
|
-
<span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_expects'>expects</span><span class='lparen'>(</span><span class='symbol'>:method_1</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_with'>with</span><span class='lparen'>(</span><span class='id identifier rubyid_includes'>includes</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>bar</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span><span class='rparen'>)</span>
|
1882
|
-
<span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_method_1'>method_1</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>foobarbaz</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span>
|
1883
|
-
<span class='comment'># no error raised</span></code></pre>
|
1884
|
-
|
1885
|
-
|
1886
|
-
<p class="example_title"><div class='inline'>
|
1887
|
-
<p>Actual parameter is a String not including substring.</p>
|
1888
|
-
</div></p>
|
1889
|
-
|
1890
|
-
<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'>'</span><span class='tstring_content'>foobaz</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span>
|
1891
|
-
<span class='comment'># error raised, because 'foobaz' does not include 'bar'</span></code></pre>
|
1892
|
-
|
1893
|
-
|
1894
|
-
<p class="example_title"><div class='inline'>
|
1895
|
-
<p>Actual parameter is a Hash including the given key.</p>
|
1896
|
-
</div></p>
|
1897
|
-
|
1898
|
-
<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>
|
1899
|
-
<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>
|
1900
|
-
<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'>=></span> <span class='int'>1</span><span class='comma'>,</span> <span class='symbol'>:bar</span> <span class='op'>=></span> <span class='int'>2</span><span class='rbrace'>}</span><span class='rparen'>)</span>
|
1901
|
-
<span class='comment'># no error raised</span></code></pre>
|
1902
|
-
|
1903
|
-
|
1904
|
-
<p class="example_title"><div class='inline'>
|
1905
|
-
<p>Actual parameter is a Hash without the given key.</p>
|
1906
|
-
</div></p>
|
1907
|
-
|
1908
|
-
<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'>=></span> <span class='int'>1</span><span class='comma'>,</span> <span class='symbol'>:baz</span> <span class='op'>=></span> <span class='int'>2</span><span class='rbrace'>}</span><span class='rparen'>)</span>
|
1909
|
-
<span class='comment'># error raised, because hash does not include key 'bar'</span></code></pre>
|
1910
|
-
|
1911
|
-
|
1912
|
-
<p class="example_title"><div class='inline'>
|
1913
|
-
<p>Actual parameter is a Hash with a key matching the given matcher.</p>
|
1914
|
-
</div></p>
|
1915
|
-
|
1916
|
-
<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>
|
1917
|
-
<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>
|
1918
|
-
<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'>'</span><span class='tstring_content'>foo</span><span class='tstring_end'>'</span></span> <span class='op'>=></span> <span class='int'>1</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>bar</span><span class='tstring_end'>'</span></span> <span class='op'>=></span> <span class='int'>2</span><span class='rbrace'>}</span><span class='rparen'>)</span>
|
1919
|
-
<span class='comment'># no error raised</span></code></pre>
|
1920
|
-
|
1921
|
-
|
1922
|
-
<p class="example_title"><div class='inline'>
|
1923
|
-
<p>Actual parameter is a Hash no key matching the given matcher.</p>
|
1924
|
-
</div></p>
|
1925
|
-
|
1926
|
-
<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'>'</span><span class='tstring_content'>foo</span><span class='tstring_end'>'</span></span> <span class='op'>=></span> <span class='int'>1</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>baz</span><span class='tstring_end'>'</span></span> <span class='op'>=></span> <span class='int'>3</span><span class='rbrace'>}</span><span class='rparen'>)</span>
|
1927
|
-
<span class='comment'># error raised, because hash does not include a key matching /ar/</span></code></pre>
|
1928
|
-
|
1929
|
-
</div>
|
1930
|
-
<p class="tag_title">Parameters:</p>
|
1931
|
-
<ul class="param">
|
1932
|
-
|
1933
|
-
<li>
|
1934
|
-
|
1935
|
-
<span class='name'>items</span>
|
1936
|
-
|
1937
|
-
|
1938
|
-
<span class='type'>(<tt>*Array</tt>)</span>
|
1939
|
-
|
1940
|
-
|
1941
|
-
|
1942
|
-
—
|
1943
|
-
<div class='inline'>
|
1944
|
-
<p>expected items.</p>
|
1945
|
-
</div>
|
1946
|
-
|
1947
|
-
</li>
|
1948
|
-
|
1949
|
-
</ul>
|
1950
|
-
|
1951
|
-
<p class="tag_title">Returns:</p>
|
1952
|
-
<ul class="return">
|
1953
|
-
|
1954
|
-
<li>
|
1955
|
-
|
1956
|
-
|
1957
|
-
<span class='type'>(<tt><span class='object_link'><a href="ParameterMatchers/Includes.html" title="Mocha::ParameterMatchers::Includes (class)">Includes</a></span></tt>)</span>
|
1958
|
-
|
1959
|
-
|
1960
|
-
|
1961
|
-
—
|
1962
|
-
<div class='inline'>
|
1963
|
-
<p>parameter matcher.</p>
|
1964
|
-
</div>
|
1965
|
-
|
1966
|
-
</li>
|
1967
|
-
|
1968
|
-
</ul>
|
1969
|
-
|
1970
|
-
<p class="tag_title">See Also:</p>
|
1971
|
-
<ul class="see">
|
1972
|
-
|
1973
|
-
<li><span class='object_link'><a href="Expectation.html#with-instance_method" title="Mocha::Expectation#with (method)">Expectation#with</a></span></li>
|
1974
|
-
|
1975
|
-
</ul>
|
1976
|
-
|
1977
|
-
</div><table class="source_code">
|
1978
|
-
<tr>
|
1979
|
-
<td>
|
1980
|
-
<pre class="lines">
|
1981
|
-
|
1982
|
-
|
1983
|
-
63
|
1984
|
-
64
|
1985
|
-
65</pre>
|
1986
|
-
</td>
|
1987
|
-
<td>
|
1988
|
-
<pre class="code"><span class="info file"># File 'lib/mocha/parameter_matchers/includes.rb', line 63</span>
|
1989
|
-
|
1990
|
-
<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>
|
1991
|
-
<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>
|
1992
|
-
<span class='kw'>end</span></pre>
|
1993
|
-
</td>
|
1994
|
-
</tr>
|
1995
|
-
</table>
|
1996
|
-
</div>
|
1997
|
-
|
1998
|
-
<div class="method_details ">
|
1999
|
-
<h3 class="signature " id="instance_of-instance_method">
|
2000
|
-
|
2001
|
-
#<strong>instance_of</strong>(klass) ⇒ <tt><span class='object_link'><a href="ParameterMatchers/InstanceOf.html" title="Mocha::ParameterMatchers::InstanceOf (class)">InstanceOf</a></span></tt>
|
2002
|
-
|
2003
|
-
|
2004
|
-
|
2005
|
-
|
2006
|
-
|
2007
|
-
</h3><div class="docstring">
|
2008
|
-
<div class="discussion">
|
2009
|
-
|
2010
|
-
<p>Matches any object that is an instance of <code>klass</code></p>
|
2011
|
-
|
2012
|
-
|
2013
|
-
</div>
|
2014
|
-
</div>
|
2015
|
-
<div class="tags">
|
2016
|
-
|
2017
|
-
<div class="examples">
|
2018
|
-
<p class="tag_title">Examples:</p>
|
2019
|
-
|
2020
|
-
|
2021
|
-
<p class="example_title"><div class='inline'>
|
2022
|
-
<p>Actual parameter is an instance of <code>String</code>.</p>
|
2023
|
-
</div></p>
|
2024
|
-
|
2025
|
-
<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>
|
2026
|
-
<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>
|
2027
|
-
<span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_method_1'>method_1</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>string</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span>
|
2028
|
-
<span class='comment'># no error raised</span></code></pre>
|
2029
|
-
|
2030
|
-
|
2031
|
-
<p class="example_title"><div class='inline'>
|
2032
|
-
<p>Actual parameter is not an instance of <code>String</code>.</p>
|
2033
|
-
</div></p>
|
2034
|
-
|
2035
|
-
<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>
|
2036
|
-
<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>
|
2037
|
-
<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>
|
2038
|
-
<span class='comment'># error raised, because method_1 was not called with an instance of String</span></code></pre>
|
2039
|
-
|
2040
|
-
</div>
|
2041
|
-
<p class="tag_title">Parameters:</p>
|
2042
|
-
<ul class="param">
|
2043
|
-
|
2044
|
-
<li>
|
2045
|
-
|
2046
|
-
<span class='name'>klass</span>
|
2047
|
-
|
2048
|
-
|
2049
|
-
<span class='type'>(<tt>Class</tt>)</span>
|
2050
|
-
|
2051
|
-
|
2052
|
-
|
2053
|
-
—
|
2054
|
-
<div class='inline'>
|
2055
|
-
<p>expected class.</p>
|
2056
|
-
</div>
|
2057
|
-
|
2058
|
-
</li>
|
2059
|
-
|
2060
|
-
</ul>
|
2061
|
-
|
2062
|
-
<p class="tag_title">Returns:</p>
|
2063
|
-
<ul class="return">
|
2064
|
-
|
2065
|
-
<li>
|
2066
|
-
|
2067
|
-
|
2068
|
-
<span class='type'>(<tt><span class='object_link'><a href="ParameterMatchers/InstanceOf.html" title="Mocha::ParameterMatchers::InstanceOf (class)">InstanceOf</a></span></tt>)</span>
|
2069
|
-
|
2070
|
-
|
2071
|
-
|
2072
|
-
—
|
2073
|
-
<div class='inline'>
|
2074
|
-
<p>parameter matcher.</p>
|
2075
|
-
</div>
|
2076
|
-
|
2077
|
-
</li>
|
2078
|
-
|
2079
|
-
</ul>
|
2080
|
-
|
2081
|
-
<p class="tag_title">See Also:</p>
|
2082
|
-
<ul class="see">
|
2083
|
-
|
2084
|
-
<li><span class='object_link'><a href="Expectation.html#with-instance_method" title="Mocha::Expectation#with (method)">Expectation#with</a></span></li>
|
2085
|
-
|
2086
|
-
<li>Kernel#instance_of?</li>
|
2087
|
-
|
2088
|
-
</ul>
|
2089
|
-
|
2090
|
-
</div><table class="source_code">
|
2091
|
-
<tr>
|
2092
|
-
<td>
|
2093
|
-
<pre class="lines">
|
2094
|
-
|
2095
|
-
|
2096
|
-
24
|
2097
|
-
25
|
2098
|
-
26</pre>
|
2099
|
-
</td>
|
2100
|
-
<td>
|
2101
|
-
<pre class="code"><span class="info file"># File 'lib/mocha/parameter_matchers/instance_of.rb', line 24</span>
|
2102
|
-
|
2103
|
-
<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>
|
2104
|
-
<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>
|
2105
|
-
<span class='kw'>end</span></pre>
|
2106
|
-
</td>
|
2107
|
-
</tr>
|
2108
|
-
</table>
|
2109
|
-
</div>
|
2110
|
-
|
2111
|
-
<div class="method_details ">
|
2112
|
-
<h3 class="signature " id="is_a-instance_method">
|
2113
|
-
|
2114
|
-
#<strong>is_a</strong>(klass) ⇒ <tt><span class='object_link'><a href="ParameterMatchers/IsA.html" title="Mocha::ParameterMatchers::IsA (class)">IsA</a></span></tt>
|
2115
|
-
|
2116
|
-
|
2117
|
-
|
2118
|
-
|
2119
|
-
|
2120
|
-
</h3><div class="docstring">
|
2121
|
-
<div class="discussion">
|
2122
|
-
|
2123
|
-
<p>Matches any object that is a <code>klass</code>.</p>
|
2124
|
-
|
2125
|
-
|
2126
|
-
</div>
|
2127
|
-
</div>
|
2128
|
-
<div class="tags">
|
2129
|
-
|
2130
|
-
<div class="examples">
|
2131
|
-
<p class="tag_title">Examples:</p>
|
2132
|
-
|
2133
|
-
|
2134
|
-
<p class="example_title"><div class='inline'>
|
2135
|
-
<p>Actual parameter is a <code>Integer</code>.</p>
|
2136
|
-
</div></p>
|
2137
|
-
|
2138
|
-
<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>
|
2139
|
-
<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>
|
2140
|
-
<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>
|
2141
|
-
<span class='comment'># no error raised</span></code></pre>
|
2142
|
-
|
2143
|
-
|
2144
|
-
<p class="example_title"><div class='inline'>
|
2145
|
-
<p>Actual parameter is not 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='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>string</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span>
|
2151
|
-
<span class='comment'># error raised, because method_1 was not called with an Integer</span></code></pre>
|
2152
|
-
|
2153
|
-
</div>
|
2154
|
-
<p class="tag_title">Parameters:</p>
|
2155
|
-
<ul class="param">
|
2156
|
-
|
2157
|
-
<li>
|
2158
|
-
|
2159
|
-
<span class='name'>klass</span>
|
2160
|
-
|
2161
|
-
|
2162
|
-
<span class='type'>(<tt>Class</tt>)</span>
|
2163
|
-
|
2164
|
-
|
2165
|
-
|
2166
|
-
—
|
2167
|
-
<div class='inline'>
|
2168
|
-
<p>expected class.</p>
|
2169
|
-
</div>
|
2170
|
-
|
2171
|
-
</li>
|
2172
|
-
|
2173
|
-
</ul>
|
2174
|
-
|
2175
|
-
<p class="tag_title">Returns:</p>
|
2176
|
-
<ul class="return">
|
2177
|
-
|
2178
|
-
<li>
|
2179
|
-
|
2180
|
-
|
2181
|
-
<span class='type'>(<tt><span class='object_link'><a href="ParameterMatchers/IsA.html" title="Mocha::ParameterMatchers::IsA (class)">IsA</a></span></tt>)</span>
|
2182
|
-
|
2183
|
-
|
2184
|
-
|
2185
|
-
—
|
2186
|
-
<div class='inline'>
|
2187
|
-
<p>parameter matcher.</p>
|
2188
|
-
</div>
|
2189
|
-
|
2190
|
-
</li>
|
2191
|
-
|
2192
|
-
</ul>
|
2193
|
-
|
2194
|
-
<p class="tag_title">See Also:</p>
|
2195
|
-
<ul class="see">
|
2196
|
-
|
2197
|
-
<li><span class='object_link'><a href="Expectation.html#with-instance_method" title="Mocha::Expectation#with (method)">Expectation#with</a></span></li>
|
2198
|
-
|
2199
|
-
<li>Kernel#is_a?</li>
|
2200
|
-
|
2201
|
-
</ul>
|
2202
|
-
|
2203
|
-
</div><table class="source_code">
|
2204
|
-
<tr>
|
2205
|
-
<td>
|
2206
|
-
<pre class="lines">
|
2207
|
-
|
2208
|
-
|
2209
|
-
25
|
2210
|
-
26
|
2211
|
-
27</pre>
|
2212
|
-
</td>
|
2213
|
-
<td>
|
2214
|
-
<pre class="code"><span class="info file"># File 'lib/mocha/parameter_matchers/is_a.rb', line 25</span>
|
2215
|
-
|
2216
|
-
<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> <span class='comment'># rubocop:disable Naming/PredicateName
|
2217
|
-
</span> <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>
|
2218
|
-
<span class='kw'>end</span></pre>
|
2219
|
-
</td>
|
2220
|
-
</tr>
|
2221
|
-
</table>
|
2222
|
-
</div>
|
2223
|
-
|
2224
|
-
<div class="method_details ">
|
2225
|
-
<h3 class="signature " id="kind_of-instance_method">
|
2226
|
-
|
2227
|
-
#<strong>kind_of</strong>(klass) ⇒ <tt><span class='object_link'><a href="ParameterMatchers/KindOf.html" title="Mocha::ParameterMatchers::KindOf (class)">KindOf</a></span></tt>
|
2228
|
-
|
2229
|
-
|
2230
|
-
|
2231
|
-
|
2232
|
-
|
2233
|
-
</h3><div class="docstring">
|
2234
|
-
<div class="discussion">
|
2235
|
-
|
2236
|
-
<p>Matches any <code>Object</code> that is a kind of <code>klass</code>.</p>
|
2237
|
-
|
2238
|
-
|
2239
|
-
</div>
|
2240
|
-
</div>
|
2241
|
-
<div class="tags">
|
2242
|
-
|
2243
|
-
<div class="examples">
|
2244
|
-
<p class="tag_title">Examples:</p>
|
2245
|
-
|
2246
|
-
|
2247
|
-
<p class="example_title"><div class='inline'>
|
2248
|
-
<p>Actual parameter is a kind of <code>Integer</code>.</p>
|
2249
|
-
</div></p>
|
2250
|
-
|
2251
|
-
<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>
|
2252
|
-
<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>
|
2253
|
-
<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>
|
2254
|
-
<span class='comment'># no error raised</span></code></pre>
|
2255
|
-
|
2256
|
-
|
2257
|
-
<p class="example_title"><div class='inline'>
|
2258
|
-
<p>Actual parameter is not 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='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>string</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span>
|
2264
|
-
<span class='comment'># error raised, because method_1 was not called with a kind of Integer</span></code></pre>
|
2265
|
-
|
2266
|
-
</div>
|
2267
|
-
<p class="tag_title">Parameters:</p>
|
2268
|
-
<ul class="param">
|
2269
|
-
|
2270
|
-
<li>
|
2271
|
-
|
2272
|
-
<span class='name'>klass</span>
|
2273
|
-
|
2274
|
-
|
2275
|
-
<span class='type'>(<tt>Class</tt>)</span>
|
2276
|
-
|
2277
|
-
|
2278
|
-
|
2279
|
-
—
|
2280
|
-
<div class='inline'>
|
2281
|
-
<p>expected class.</p>
|
2282
|
-
</div>
|
2283
|
-
|
2284
|
-
</li>
|
2285
|
-
|
2286
|
-
</ul>
|
2287
|
-
|
2288
|
-
<p class="tag_title">Returns:</p>
|
2289
|
-
<ul class="return">
|
2290
|
-
|
2291
|
-
<li>
|
2292
|
-
|
2293
|
-
|
2294
|
-
<span class='type'>(<tt><span class='object_link'><a href="ParameterMatchers/KindOf.html" title="Mocha::ParameterMatchers::KindOf (class)">KindOf</a></span></tt>)</span>
|
2295
|
-
|
2296
|
-
|
2297
|
-
|
2298
|
-
—
|
2299
|
-
<div class='inline'>
|
2300
|
-
<p>parameter matcher.</p>
|
2301
|
-
</div>
|
2302
|
-
|
2303
|
-
</li>
|
2304
|
-
|
2305
|
-
</ul>
|
2306
|
-
|
2307
|
-
<p class="tag_title">See Also:</p>
|
2308
|
-
<ul class="see">
|
2309
|
-
|
2310
|
-
<li><span class='object_link'><a href="Expectation.html#with-instance_method" title="Mocha::Expectation#with (method)">Expectation#with</a></span></li>
|
2311
|
-
|
2312
|
-
<li>Kernel#kind_of?</li>
|
2313
|
-
|
2314
|
-
</ul>
|
2315
|
-
|
2316
|
-
</div><table class="source_code">
|
2317
|
-
<tr>
|
2318
|
-
<td>
|
2319
|
-
<pre class="lines">
|
2320
|
-
|
2321
|
-
|
2322
|
-
24
|
2323
|
-
25
|
2324
|
-
26</pre>
|
2325
|
-
</td>
|
2326
|
-
<td>
|
2327
|
-
<pre class="code"><span class="info file"># File 'lib/mocha/parameter_matchers/kind_of.rb', line 24</span>
|
2328
|
-
|
2329
|
-
<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>
|
2330
|
-
<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>
|
2331
|
-
<span class='kw'>end</span></pre>
|
2332
|
-
</td>
|
2333
|
-
</tr>
|
2334
|
-
</table>
|
2335
|
-
</div>
|
2336
|
-
|
2337
|
-
<div class="method_details ">
|
2338
|
-
<h3 class="signature " id="Not-instance_method">
|
2339
|
-
|
2340
|
-
#<strong>Not</strong>(matcher) ⇒ <tt><span class='object_link'><a href="ParameterMatchers/Not.html" title="Mocha::ParameterMatchers::Not (class)">Not</a></span></tt>
|
2341
|
-
|
2342
|
-
|
2343
|
-
|
2344
|
-
|
2345
|
-
|
2346
|
-
</h3><div class="docstring">
|
2347
|
-
<div class="discussion">
|
2348
|
-
|
2349
|
-
<p>Matches if <code>matcher</code> does <strong>not</strong> match.</p>
|
2350
|
-
|
2351
|
-
|
2352
|
-
</div>
|
2353
|
-
</div>
|
2354
|
-
<div class="tags">
|
2355
|
-
|
2356
|
-
<div class="examples">
|
2357
|
-
<p class="tag_title">Examples:</p>
|
2358
|
-
|
2359
|
-
|
2360
|
-
<p class="example_title"><div class='inline'>
|
2361
|
-
<p>Actual parameter does not include the value <code>1</code>.</p>
|
2362
|
-
</div></p>
|
2363
|
-
|
2364
|
-
<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>
|
2365
|
-
<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>
|
2366
|
-
<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>
|
2367
|
-
<span class='comment'># no error raised</span></code></pre>
|
2368
|
-
|
2369
|
-
|
2370
|
-
<p class="example_title"><div class='inline'>
|
2371
|
-
<p>Actual parameter does include the value <code>1</code>.</p>
|
2372
|
-
</div></p>
|
2373
|
-
|
2374
|
-
<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>
|
2375
|
-
<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>
|
2376
|
-
<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>
|
2377
|
-
<span class='comment'># error raised, because method_1 was not called with object not including 1</span></code></pre>
|
2378
|
-
|
2379
|
-
</div>
|
2380
|
-
<p class="tag_title">Parameters:</p>
|
2381
|
-
<ul class="param">
|
2382
|
-
|
2383
|
-
<li>
|
2384
|
-
|
2385
|
-
<span class='name'>matcher</span>
|
2386
|
-
|
2387
|
-
|
2388
|
-
<span class='type'>(<tt><span class='object_link'><a href="ParameterMatchers/Base.html" title="Mocha::ParameterMatchers::Base (class)">Base</a></span></tt>)</span>
|
2389
|
-
|
2390
|
-
|
2391
|
-
|
2392
|
-
—
|
2393
|
-
<div class='inline'>
|
2394
|
-
<p>matcher whose logic to invert.</p>
|
2395
|
-
</div>
|
2396
|
-
|
2397
|
-
</li>
|
2398
|
-
|
2399
|
-
</ul>
|
2400
|
-
|
2401
|
-
<p class="tag_title">Returns:</p>
|
2402
|
-
<ul class="return">
|
2403
|
-
|
2404
|
-
<li>
|
2405
|
-
|
2406
|
-
|
2407
|
-
<span class='type'>(<tt><span class='object_link'><a href="ParameterMatchers/Not.html" title="Mocha::ParameterMatchers::Not (class)">Not</a></span></tt>)</span>
|
2408
|
-
|
2409
|
-
|
2410
|
-
|
2411
|
-
—
|
2412
|
-
<div class='inline'>
|
2413
|
-
<p>parameter matcher.</p>
|
2414
|
-
</div>
|
2415
|
-
|
2416
|
-
</li>
|
2417
|
-
|
2418
|
-
</ul>
|
2419
|
-
|
2420
|
-
<p class="tag_title">See Also:</p>
|
2421
|
-
<ul class="see">
|
2422
|
-
|
2423
|
-
<li><span class='object_link'><a href="Expectation.html#with-instance_method" title="Mocha::Expectation#with (method)">Expectation#with</a></span></li>
|
2424
|
-
|
2425
|
-
</ul>
|
2426
|
-
|
2427
|
-
</div><table class="source_code">
|
2428
|
-
<tr>
|
2429
|
-
<td>
|
2430
|
-
<pre class="lines">
|
2431
|
-
|
2432
|
-
|
2433
|
-
24
|
2434
|
-
25
|
2435
|
-
26</pre>
|
2436
|
-
</td>
|
2437
|
-
<td>
|
2438
|
-
<pre class="code"><span class="info file"># File 'lib/mocha/parameter_matchers/not.rb', line 24</span>
|
2439
|
-
|
2440
|
-
<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> <span class='comment'># rubocop:disable Naming/MethodName
|
2441
|
-
</span> <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>
|
2442
|
-
<span class='kw'>end</span></pre>
|
2443
|
-
</td>
|
2444
|
-
</tr>
|
2445
|
-
</table>
|
2446
|
-
</div>
|
2447
|
-
|
2448
|
-
<div class="method_details ">
|
2449
|
-
<h3 class="signature " id="optionally-instance_method">
|
2450
|
-
|
2451
|
-
#<strong>optionally</strong>(*matchers) ⇒ <tt><span class='object_link'><a href="ParameterMatchers/Optionally.html" title="Mocha::ParameterMatchers::Optionally (class)">Optionally</a></span></tt>
|
2452
|
-
|
2453
|
-
|
2454
|
-
|
2455
|
-
|
2456
|
-
|
2457
|
-
</h3><div class="docstring">
|
2458
|
-
<div class="discussion">
|
2459
|
-
|
2460
|
-
<p>Matches optional parameters if available.</p>
|
2461
|
-
|
2462
|
-
|
2463
|
-
</div>
|
2464
|
-
</div>
|
2465
|
-
<div class="tags">
|
2466
|
-
|
2467
|
-
<div class="examples">
|
2468
|
-
<p class="tag_title">Examples:</p>
|
2469
|
-
|
2470
|
-
|
2471
|
-
<p class="example_title"><div class='inline'>
|
2472
|
-
<p>Only the two required parameters are supplied and they both match their expected value.</p>
|
2473
|
-
</div></p>
|
2474
|
-
|
2475
|
-
<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>
|
2476
|
-
<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>
|
2477
|
-
<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>
|
2478
|
-
<span class='comment'># no error raised</span></code></pre>
|
2479
|
-
|
2480
|
-
|
2481
|
-
<p class="example_title"><div class='inline'>
|
2482
|
-
<p>Both required parameters and one of the optional parameters are supplied and they all match their expected value.</p>
|
2483
|
-
</div></p>
|
2484
|
-
|
2485
|
-
<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>
|
2486
|
-
<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>
|
2487
|
-
<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>
|
2488
|
-
<span class='comment'># no error raised</span></code></pre>
|
2489
|
-
|
2490
|
-
|
2491
|
-
<p class="example_title"><div class='inline'>
|
2492
|
-
<p>Both required parameters and both of the optional parameters are supplied and they all match their expected value.</p>
|
2493
|
-
</div></p>
|
2494
|
-
|
2495
|
-
<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>
|
2496
|
-
<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>
|
2497
|
-
<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>
|
2498
|
-
<span class='comment'># no error raised</span></code></pre>
|
2499
|
-
|
2500
|
-
|
2501
|
-
<p class="example_title"><div class='inline'>
|
2502
|
-
<p>One of the actual optional parameters does not match the expected value.</p>
|
2503
|
-
</div></p>
|
2504
|
-
|
2505
|
-
<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>
|
2506
|
-
<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>
|
2507
|
-
<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>
|
2508
|
-
<span class='comment'># error raised, because optional parameters did not match</span></code></pre>
|
2509
|
-
|
2510
|
-
</div>
|
2511
|
-
<p class="tag_title">Parameters:</p>
|
2512
|
-
<ul class="param">
|
2513
|
-
|
2514
|
-
<li>
|
2515
|
-
|
2516
|
-
<span class='name'>matchers</span>
|
2517
|
-
|
2518
|
-
|
2519
|
-
<span class='type'>(<tt>*Array<<span class='object_link'><a href="ParameterMatchers/Base.html" title="Mocha::ParameterMatchers::Base (class)">Base</a></span>></tt>)</span>
|
2520
|
-
|
2521
|
-
|
2522
|
-
|
2523
|
-
—
|
2524
|
-
<div class='inline'>
|
2525
|
-
<p>matchers for optional parameters.</p>
|
2526
|
-
</div>
|
2527
|
-
|
2528
|
-
</li>
|
2529
|
-
|
2530
|
-
</ul>
|
2531
|
-
|
2532
|
-
<p class="tag_title">Returns:</p>
|
2533
|
-
<ul class="return">
|
2534
|
-
|
2535
|
-
<li>
|
2536
|
-
|
2537
|
-
|
2538
|
-
<span class='type'>(<tt><span class='object_link'><a href="ParameterMatchers/Optionally.html" title="Mocha::ParameterMatchers::Optionally (class)">Optionally</a></span></tt>)</span>
|
2539
|
-
|
2540
|
-
|
2541
|
-
|
2542
|
-
—
|
2543
|
-
<div class='inline'>
|
2544
|
-
<p>parameter matcher.</p>
|
2545
|
-
</div>
|
2546
|
-
|
2547
|
-
</li>
|
2548
|
-
|
2549
|
-
</ul>
|
2550
|
-
|
2551
|
-
<p class="tag_title">See Also:</p>
|
2552
|
-
<ul class="see">
|
2553
|
-
|
2554
|
-
<li><span class='object_link'><a href="Expectation.html#with-instance_method" title="Mocha::Expectation#with (method)">Expectation#with</a></span></li>
|
2555
|
-
|
2556
|
-
</ul>
|
2557
|
-
|
2558
|
-
</div><table class="source_code">
|
2559
|
-
<tr>
|
2560
|
-
<td>
|
2561
|
-
<pre class="lines">
|
2562
|
-
|
2563
|
-
|
2564
|
-
33
|
2565
|
-
34
|
2566
|
-
35</pre>
|
2567
|
-
</td>
|
2568
|
-
<td>
|
2569
|
-
<pre class="code"><span class="info file"># File 'lib/mocha/parameter_matchers/optionally.rb', line 33</span>
|
2570
|
-
|
2571
|
-
<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>
|
2572
|
-
<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>
|
2573
|
-
<span class='kw'>end</span></pre>
|
2574
|
-
</td>
|
2575
|
-
</tr>
|
2576
|
-
</table>
|
2577
|
-
</div>
|
2578
|
-
|
2579
|
-
<div class="method_details ">
|
2580
|
-
<h3 class="signature " id="regexp_matches-instance_method">
|
2581
|
-
|
2582
|
-
#<strong>regexp_matches</strong>(regexp) ⇒ <tt><span class='object_link'><a href="ParameterMatchers/RegexpMatches.html" title="Mocha::ParameterMatchers::RegexpMatches (class)">RegexpMatches</a></span></tt>
|
2583
|
-
|
2584
|
-
|
2585
|
-
|
2586
|
-
|
2587
|
-
|
2588
|
-
</h3><div class="docstring">
|
2589
|
-
<div class="discussion">
|
2590
|
-
|
2591
|
-
<p>Matches any object that matches <code>regexp</code>.</p>
|
2592
|
-
|
2593
|
-
|
2594
|
-
</div>
|
2595
|
-
</div>
|
2596
|
-
<div class="tags">
|
2597
|
-
|
2598
|
-
<div class="examples">
|
2599
|
-
<p class="tag_title">Examples:</p>
|
2600
|
-
|
2601
|
-
|
2602
|
-
<p class="example_title"><div class='inline'>
|
2603
|
-
<p>Actual parameter is matched by specified regular expression.</p>
|
2604
|
-
</div></p>
|
2605
|
-
|
2606
|
-
<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>
|
2607
|
-
<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>
|
2608
|
-
<span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_method_1'>method_1</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>hello</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span>
|
2609
|
-
<span class='comment'># no error raised</span></code></pre>
|
2610
|
-
|
2611
|
-
|
2612
|
-
<p class="example_title"><div class='inline'>
|
2613
|
-
<p>Actual parameter is not matched by specified regular expression.</p>
|
2614
|
-
</div></p>
|
2615
|
-
|
2616
|
-
<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>
|
2617
|
-
<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>
|
2618
|
-
<span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_method_1'>method_1</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>hello</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span>
|
2619
|
-
<span class='comment'># error raised, because method_1 was not called with a parameter that matched the
|
2620
|
-
</span><span class='comment'># regular expression</span></code></pre>
|
2621
|
-
|
2622
|
-
</div>
|
2623
|
-
<p class="tag_title">Parameters:</p>
|
2624
|
-
<ul class="param">
|
2625
|
-
|
2626
|
-
<li>
|
2627
|
-
|
2628
|
-
<span class='name'>regexp</span>
|
2629
|
-
|
2630
|
-
|
2631
|
-
<span class='type'>(<tt>Regexp</tt>)</span>
|
2632
|
-
|
2633
|
-
|
2634
|
-
|
2635
|
-
—
|
2636
|
-
<div class='inline'>
|
2637
|
-
<p>regular expression to match.</p>
|
2638
|
-
</div>
|
2639
|
-
|
2640
|
-
</li>
|
2641
|
-
|
2642
|
-
</ul>
|
2643
|
-
|
2644
|
-
<p class="tag_title">Returns:</p>
|
2645
|
-
<ul class="return">
|
2646
|
-
|
2647
|
-
<li>
|
2648
|
-
|
2649
|
-
|
2650
|
-
<span class='type'>(<tt><span class='object_link'><a href="ParameterMatchers/RegexpMatches.html" title="Mocha::ParameterMatchers::RegexpMatches (class)">RegexpMatches</a></span></tt>)</span>
|
2651
|
-
|
2652
|
-
|
2653
|
-
|
2654
|
-
—
|
2655
|
-
<div class='inline'>
|
2656
|
-
<p>parameter matcher.</p>
|
2657
|
-
</div>
|
2658
|
-
|
2659
|
-
</li>
|
2660
|
-
|
2661
|
-
</ul>
|
2662
|
-
|
2663
|
-
<p class="tag_title">See Also:</p>
|
2664
|
-
<ul class="see">
|
2665
|
-
|
2666
|
-
<li><span class='object_link'><a href="Expectation.html#with-instance_method" title="Mocha::Expectation#with (method)">Expectation#with</a></span></li>
|
2667
|
-
|
2668
|
-
</ul>
|
2669
|
-
|
2670
|
-
</div><table class="source_code">
|
2671
|
-
<tr>
|
2672
|
-
<td>
|
2673
|
-
<pre class="lines">
|
2674
|
-
|
2675
|
-
|
2676
|
-
24
|
2677
|
-
25
|
2678
|
-
26</pre>
|
2679
|
-
</td>
|
2680
|
-
<td>
|
2681
|
-
<pre class="code"><span class="info file"># File 'lib/mocha/parameter_matchers/regexp_matches.rb', line 24</span>
|
2682
|
-
|
2683
|
-
<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>
|
2684
|
-
<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>
|
2685
|
-
<span class='kw'>end</span></pre>
|
2686
|
-
</td>
|
2687
|
-
</tr>
|
2688
|
-
</table>
|
2689
|
-
</div>
|
2690
|
-
|
2691
|
-
<div class="method_details ">
|
2692
|
-
<h3 class="signature " id="responds_with-instance_method">
|
2693
|
-
|
2694
|
-
#<strong>responds_with</strong>(message, result) ⇒ <tt><span class='object_link'><a href="ParameterMatchers/RespondsWith.html" title="Mocha::ParameterMatchers::RespondsWith (class)">RespondsWith</a></span></tt>
|
2695
|
-
|
2696
|
-
|
2697
|
-
|
2698
|
-
|
2699
|
-
|
2700
|
-
</h3><div class="docstring">
|
2701
|
-
<div class="discussion">
|
2702
|
-
|
2703
|
-
<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>
|
2704
|
-
|
2705
|
-
|
2706
|
-
</div>
|
2707
|
-
</div>
|
2708
|
-
<div class="tags">
|
2709
|
-
|
2710
|
-
<div class="examples">
|
2711
|
-
<p class="tag_title">Examples:</p>
|
2712
|
-
|
2713
|
-
|
2714
|
-
<p class="example_title"><div class='inline'>
|
2715
|
-
<p>Actual parameter responds with “FOO” when :upcase is invoked.</p>
|
2716
|
-
</div></p>
|
2717
|
-
|
2718
|
-
<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>
|
2719
|
-
<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'>"</span><span class='tstring_content'>FOO</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span><span class='rparen'>)</span>
|
2720
|
-
<span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_method_1'>method_1</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>foo</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
2721
|
-
<span class='comment'># no error raised, because "foo".upcase == "FOO"</span></code></pre>
|
2722
|
-
|
2723
|
-
|
2724
|
-
<p class="example_title"><div class='inline'>
|
2725
|
-
<p>Actual parameter does not respond with “FOO” when :upcase is invoked.</p>
|
2726
|
-
</div></p>
|
2727
|
-
|
2728
|
-
<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>
|
2729
|
-
<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'>"</span><span class='tstring_content'>BAR</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span><span class='rparen'>)</span>
|
2730
|
-
<span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_method_1'>method_1</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>foo</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
2731
|
-
<span class='comment'># error raised, because "foo".upcase != "BAR"</span></code></pre>
|
2732
|
-
|
2733
|
-
</div>
|
2734
|
-
<p class="tag_title">Parameters:</p>
|
2735
|
-
<ul class="param">
|
2736
|
-
|
2737
|
-
<li>
|
2738
|
-
|
2739
|
-
<span class='name'>message</span>
|
2740
|
-
|
2741
|
-
|
2742
|
-
<span class='type'>(<tt>Symbol</tt>)</span>
|
2743
|
-
|
2744
|
-
|
2745
|
-
|
2746
|
-
—
|
2747
|
-
<div class='inline'>
|
2748
|
-
<p>method to invoke.</p>
|
2749
|
-
</div>
|
2750
|
-
|
2751
|
-
</li>
|
2752
|
-
|
2753
|
-
<li>
|
2754
|
-
|
2755
|
-
<span class='name'>result</span>
|
2756
|
-
|
2757
|
-
|
2758
|
-
<span class='type'>(<tt><span class='object_link'>Object</span></tt>)</span>
|
2759
|
-
|
2760
|
-
|
2761
|
-
|
2762
|
-
—
|
2763
|
-
<div class='inline'>
|
2764
|
-
<p>expected result of sending <code>message</code>.</p>
|
2765
|
-
</div>
|
2766
|
-
|
2767
|
-
</li>
|
2768
|
-
|
2769
|
-
</ul>
|
2770
|
-
|
2771
|
-
<p class="tag_title">Returns:</p>
|
2772
|
-
<ul class="return">
|
2773
|
-
|
2774
|
-
<li>
|
2775
|
-
|
2776
|
-
|
2777
|
-
<span class='type'>(<tt><span class='object_link'><a href="ParameterMatchers/RespondsWith.html" title="Mocha::ParameterMatchers::RespondsWith (class)">RespondsWith</a></span></tt>)</span>
|
2778
|
-
|
2779
|
-
|
2780
|
-
|
2781
|
-
—
|
2782
|
-
<div class='inline'>
|
2783
|
-
<p>parameter matcher.</p>
|
2784
|
-
</div>
|
2785
|
-
|
2786
|
-
</li>
|
2787
|
-
|
2788
|
-
</ul>
|
2789
|
-
|
2790
|
-
<p class="tag_title">See Also:</p>
|
2791
|
-
<ul class="see">
|
2792
|
-
|
2793
|
-
<li><span class='object_link'><a href="Expectation.html#with-instance_method" title="Mocha::Expectation#with (method)">Expectation#with</a></span></li>
|
2794
|
-
|
2795
|
-
</ul>
|
2796
|
-
|
2797
|
-
</div><table class="source_code">
|
2798
|
-
<tr>
|
2799
|
-
<td>
|
2800
|
-
<pre class="lines">
|
2801
|
-
|
2802
|
-
|
2803
|
-
25
|
2804
|
-
26
|
2805
|
-
27</pre>
|
2806
|
-
</td>
|
2807
|
-
<td>
|
2808
|
-
<pre class="code"><span class="info file"># File 'lib/mocha/parameter_matchers/responds_with.rb', line 25</span>
|
2809
|
-
|
2810
|
-
<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>
|
2811
|
-
<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>
|
2812
|
-
<span class='kw'>end</span></pre>
|
2813
|
-
</td>
|
2814
|
-
</tr>
|
2815
|
-
</table>
|
2816
|
-
</div>
|
2817
|
-
|
2818
|
-
<div class="method_details ">
|
2819
|
-
<h3 class="signature " id="yaml_equivalent-instance_method">
|
2820
|
-
|
2821
|
-
#<strong>yaml_equivalent</strong>(object) ⇒ <tt><span class='object_link'><a href="ParameterMatchers/YamlEquivalent.html" title="Mocha::ParameterMatchers::YamlEquivalent (class)">YamlEquivalent</a></span></tt>
|
2822
|
-
|
2823
|
-
|
2824
|
-
|
2825
|
-
|
2826
|
-
|
2827
|
-
</h3><div class="docstring">
|
2828
|
-
<div class="discussion">
|
2829
|
-
|
2830
|
-
<p>Matches any YAML that represents the specified <code>object</code></p>
|
2831
|
-
|
2832
|
-
|
2833
|
-
</div>
|
2834
|
-
</div>
|
2835
|
-
<div class="tags">
|
2836
|
-
|
2837
|
-
<div class="examples">
|
2838
|
-
<p class="tag_title">Examples:</p>
|
2839
|
-
|
2840
|
-
|
2841
|
-
<p class="example_title"><div class='inline'>
|
2842
|
-
<p>Actual parameter is YAML equivalent of specified <code>object</code>.</p>
|
2843
|
-
</div></p>
|
2844
|
-
|
2845
|
-
<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>
|
2846
|
-
<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>
|
2847
|
-
<span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_method_1'>method_1</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>--- \n- 1\n- 2\n- 3\n</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
2848
|
-
<span class='comment'># no error raised</span></code></pre>
|
2849
|
-
|
2850
|
-
|
2851
|
-
<p class="example_title"><div class='inline'>
|
2852
|
-
<p>Actual parameter is not YAML equivalent of specified <code>object</code>.</p>
|
2853
|
-
</div></p>
|
2854
|
-
|
2855
|
-
<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>
|
2856
|
-
<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>
|
2857
|
-
<span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_method_1'>method_1</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>--- \n- 1\n- 2\n</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
2858
|
-
<span class='comment'># error raised, because method_1 was not called with YAML representing the specified Array</span></code></pre>
|
2859
|
-
|
2860
|
-
</div>
|
2861
|
-
<p class="tag_title">Parameters:</p>
|
2862
|
-
<ul class="param">
|
2863
|
-
|
2864
|
-
<li>
|
2865
|
-
|
2866
|
-
<span class='name'>object</span>
|
2867
|
-
|
2868
|
-
|
2869
|
-
<span class='type'>(<tt><span class='object_link'>Object</span></tt>)</span>
|
2870
|
-
|
2871
|
-
|
2872
|
-
|
2873
|
-
—
|
2874
|
-
<div class='inline'>
|
2875
|
-
<p>object whose YAML to compare.</p>
|
2876
|
-
</div>
|
2877
|
-
|
2878
|
-
</li>
|
2879
|
-
|
2880
|
-
</ul>
|
2881
|
-
|
2882
|
-
<p class="tag_title">Returns:</p>
|
2883
|
-
<ul class="return">
|
2884
|
-
|
2885
|
-
<li>
|
2886
|
-
|
2887
|
-
|
2888
|
-
<span class='type'>(<tt><span class='object_link'><a href="ParameterMatchers/YamlEquivalent.html" title="Mocha::ParameterMatchers::YamlEquivalent (class)">YamlEquivalent</a></span></tt>)</span>
|
2889
|
-
|
2890
|
-
|
2891
|
-
|
2892
|
-
—
|
2893
|
-
<div class='inline'>
|
2894
|
-
<p>parameter matcher.</p>
|
2895
|
-
</div>
|
2896
|
-
|
2897
|
-
</li>
|
2898
|
-
|
2899
|
-
</ul>
|
2900
|
-
|
2901
|
-
<p class="tag_title">See Also:</p>
|
2902
|
-
<ul class="see">
|
2903
|
-
|
2904
|
-
<li><span class='object_link'><a href="Expectation.html#with-instance_method" title="Mocha::Expectation#with (method)">Expectation#with</a></span></li>
|
2905
|
-
|
2906
|
-
</ul>
|
2907
|
-
|
2908
|
-
</div><table class="source_code">
|
2909
|
-
<tr>
|
2910
|
-
<td>
|
2911
|
-
<pre class="lines">
|
2912
|
-
|
2913
|
-
|
2914
|
-
24
|
2915
|
-
25
|
2916
|
-
26</pre>
|
2917
|
-
</td>
|
2918
|
-
<td>
|
2919
|
-
<pre class="code"><span class="info file"># File 'lib/mocha/parameter_matchers/yaml_equivalent.rb', line 24</span>
|
2920
|
-
|
2921
|
-
<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>
|
2922
|
-
<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>
|
2923
|
-
<span class='kw'>end</span></pre>
|
2924
|
-
</td>
|
2925
|
-
</tr>
|
2926
|
-
</table>
|
2927
|
-
</div>
|
2928
|
-
|
2929
|
-
</div>
|
2930
|
-
|
2931
|
-
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-625523-7"></script>
|
2932
|
-
<script>
|
2933
|
-
window.dataLayer = window.dataLayer || [];
|
2934
|
-
function gtag(){dataLayer.push(arguments);}
|
2935
|
-
gtag('js', new Date());
|
2936
|
-
|
2937
|
-
gtag('config', 'UA-625523-7');
|
2938
|
-
</script>
|
2939
|
-
</div>
|
2940
|
-
|
2941
|
-
<div id="footer">
|
2942
|
-
Generated on Sat Jan 4 17:36:47 2020 by
|
2943
|
-
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
2944
|
-
0.9.20 (ruby-2.6.5).
|
2945
|
-
</div>
|
2946
|
-
|
2947
|
-
</div>
|
2948
|
-
</body>
|
2949
|
-
</html>
|