mocha 0.10.5 → 0.11.0
Sign up to get free protection for your applications and to get access to all the features.
- data/COPYING.rdoc +1 -1
- data/README.rdoc +6 -4
- data/RELEASE.rdoc +12 -0
- data/Rakefile +29 -60
- data/doc/Mocha.html +112 -0
- data/doc/Mocha/API.html +898 -0
- data/doc/Mocha/ClassMethods.html +246 -0
- data/doc/Mocha/Configuration.html +471 -0
- data/doc/Mocha/Expectation.html +2570 -0
- data/doc/Mocha/Mock.html +830 -0
- data/doc/Mocha/ObjectMethods.html +668 -0
- data/doc/Mocha/ParameterMatchers.html +2715 -0
- data/doc/Mocha/ParameterMatchers/AllOf.html +137 -0
- data/doc/Mocha/ParameterMatchers/AnyOf.html +137 -0
- data/doc/Mocha/ParameterMatchers/AnyParameters.html +136 -0
- data/doc/Mocha/ParameterMatchers/Anything.html +136 -0
- data/doc/Mocha/ParameterMatchers/Base.html +419 -0
- data/doc/Mocha/ParameterMatchers/Equals.html +137 -0
- data/doc/Mocha/ParameterMatchers/HasEntries.html +137 -0
- data/doc/Mocha/ParameterMatchers/HasEntry.html +137 -0
- data/doc/Mocha/ParameterMatchers/HasKey.html +137 -0
- data/doc/Mocha/ParameterMatchers/HasValue.html +137 -0
- data/doc/Mocha/ParameterMatchers/Includes.html +137 -0
- data/doc/Mocha/ParameterMatchers/InstanceOf.html +137 -0
- data/doc/Mocha/ParameterMatchers/IsA.html +136 -0
- data/doc/Mocha/ParameterMatchers/KindOf.html +137 -0
- data/doc/Mocha/ParameterMatchers/Not.html +137 -0
- data/doc/Mocha/ParameterMatchers/Optionally.html +136 -0
- data/doc/Mocha/ParameterMatchers/QueryStringMatches.html +136 -0
- data/doc/Mocha/ParameterMatchers/RegexpMatches.html +137 -0
- data/doc/Mocha/ParameterMatchers/RespondsWith.html +137 -0
- data/doc/Mocha/ParameterMatchers/YamlEquivalent.html +137 -0
- data/doc/Mocha/Sequence.html +133 -0
- data/doc/Mocha/StateMachine.html +510 -0
- data/doc/Mocha/StateMachine/State.html +125 -0
- data/doc/Mocha/StateMachine/StatePredicate.html +125 -0
- data/doc/Mocha/StubbingError.html +134 -0
- data/doc/Mocha/UnexpectedInvocation.html +124 -0
- data/doc/_index.html +481 -0
- data/doc/class_list.html +47 -0
- data/doc/css/common.css +1 -0
- data/doc/css/full_list.css +55 -0
- data/doc/css/style.css +322 -0
- data/doc/file.COPYING.html +72 -0
- data/doc/file.MIT-LICENSE.html +86 -0
- data/doc/file.README.html +153 -0
- data/doc/file.RELEASE.html +933 -0
- data/doc/file.misc.html +108 -0
- data/doc/file.mocha.html +90 -0
- data/doc/file.stubba.html +129 -0
- data/doc/file_list.html +67 -0
- data/doc/frames.html +13 -0
- data/doc/index.html +153 -0
- data/doc/js/app.js +205 -0
- data/doc/js/full_list.js +173 -0
- data/doc/js/jquery.js +16 -0
- data/doc/method_list.html +510 -0
- data/doc/top-level-namespace.html +105 -0
- data/lib/mocha/any_instance_method.rb +16 -11
- data/lib/mocha/api.rb +120 -106
- data/lib/mocha/argument_iterator.rb +6 -6
- data/lib/mocha/backtrace_filter.rb +1 -1
- data/lib/mocha/cardinality.rb +21 -21
- data/lib/mocha/central.rb +8 -8
- data/lib/mocha/change_state_side_effect.rb +5 -5
- data/lib/mocha/class_method.rb +14 -19
- data/lib/mocha/configuration.rb +47 -37
- data/lib/mocha/deprecation.rb +8 -8
- data/lib/mocha/exception_raiser.rb +7 -7
- data/lib/mocha/expectation.rb +173 -77
- data/lib/mocha/expectation_error.rb +2 -2
- data/lib/mocha/expectation_list.rb +11 -11
- data/lib/mocha/in_state_ordering_constraint.rb +5 -5
- data/lib/mocha/inspect.rb +8 -8
- data/lib/mocha/instance_method.rb +1 -17
- data/lib/mocha/integration.rb +9 -9
- data/lib/mocha/integration/mini_test/assertion_counter.rb +9 -9
- data/lib/mocha/integration/mini_test/exception_translation.rb +6 -6
- data/lib/mocha/integration/mini_test/version_13.rb +6 -6
- data/lib/mocha/integration/mini_test/version_140.rb +6 -6
- data/lib/mocha/integration/mini_test/version_141.rb +6 -6
- data/lib/mocha/integration/mini_test/version_142_to_172.rb +7 -7
- data/lib/mocha/integration/mini_test/version_200.rb +7 -7
- data/lib/mocha/integration/test_unit/assertion_counter.rb +10 -10
- data/lib/mocha/integration/test_unit/gem_version_200.rb +6 -6
- data/lib/mocha/integration/test_unit/gem_version_201_to_202.rb +6 -6
- data/lib/mocha/integration/test_unit/ruby_version_185_and_below.rb +6 -6
- data/lib/mocha/integration/test_unit/ruby_version_186_and_above.rb +6 -6
- data/lib/mocha/is_a.rb +1 -1
- data/lib/mocha/logger.rb +6 -6
- data/lib/mocha/method_matcher.rb +7 -7
- data/lib/mocha/mock.rb +85 -48
- data/lib/mocha/mockery.rb +47 -33
- data/lib/mocha/module_method.rb +2 -2
- data/lib/mocha/multiple_yields.rb +9 -9
- data/lib/mocha/names.rb +18 -18
- data/lib/mocha/no_yields.rb +7 -7
- data/lib/mocha/object.rb +104 -75
- data/lib/mocha/parameter_matchers.rb +3 -3
- data/lib/mocha/parameter_matchers/all_of.rb +22 -12
- data/lib/mocha/parameter_matchers/any_of.rb +23 -12
- data/lib/mocha/parameter_matchers/any_parameters.rb +15 -8
- data/lib/mocha/parameter_matchers/anything.rb +20 -11
- data/lib/mocha/parameter_matchers/base.rb +35 -27
- data/lib/mocha/parameter_matchers/equals.rb +23 -12
- data/lib/mocha/parameter_matchers/has_entries.rb +22 -12
- data/lib/mocha/parameter_matchers/has_entry.rb +31 -13
- data/lib/mocha/parameter_matchers/has_key.rb +21 -11
- data/lib/mocha/parameter_matchers/has_value.rb +21 -11
- data/lib/mocha/parameter_matchers/includes.rb +15 -5
- data/lib/mocha/parameter_matchers/instance_of.rb +23 -12
- data/lib/mocha/parameter_matchers/is_a.rb +23 -12
- data/lib/mocha/parameter_matchers/kind_of.rb +23 -12
- data/lib/mocha/parameter_matchers/not.rb +22 -12
- data/lib/mocha/parameter_matchers/object.rb +5 -3
- data/lib/mocha/parameter_matchers/optionally.rb +24 -12
- data/lib/mocha/parameter_matchers/query_string.rb +14 -3
- data/lib/mocha/parameter_matchers/regexp_matches.rb +21 -11
- data/lib/mocha/parameter_matchers/responds_with.rb +17 -6
- data/lib/mocha/parameter_matchers/yaml_equivalent.rb +16 -6
- data/lib/mocha/parameters_matcher.rb +8 -8
- data/lib/mocha/pretty_parameters.rb +7 -7
- data/lib/mocha/return_values.rb +11 -11
- data/lib/mocha/sequence.rb +23 -14
- data/lib/mocha/single_return_value.rb +7 -7
- data/lib/mocha/single_yield.rb +9 -9
- data/lib/mocha/standalone.rb +1 -1
- data/lib/mocha/state_machine.rb +61 -46
- data/lib/mocha/stubbing_error.rb +8 -5
- data/lib/mocha/thrower.rb +2 -2
- data/lib/mocha/unexpected_invocation.rb +9 -6
- data/lib/mocha/version.rb +1 -1
- data/lib/mocha/yield_parameters.rb +10 -10
- data/lib/mocha_standalone.rb +1 -1
- data/mocha.gemspec +4 -7
- data/test/acceptance/acceptance_test_helper.rb +10 -10
- data/test/acceptance/api_test.rb +20 -20
- data/test/acceptance/bug_18914_test.rb +12 -12
- data/test/acceptance/bug_21465_test.rb +6 -6
- data/test/acceptance/bug_21563_test.rb +5 -5
- data/test/acceptance/exception_rescue_test.rb +1 -1
- data/test/acceptance/expected_invocation_count_test.rb +17 -17
- data/test/acceptance/failure_messages_test.rb +13 -13
- data/test/acceptance/minitest_test.rb +39 -39
- data/test/acceptance/mocha_example_test.rb +26 -26
- data/test/acceptance/mocha_test_result_test.rb +13 -13
- data/test/acceptance/mock_test.rb +5 -5
- data/test/acceptance/mock_with_initializer_block_test.rb +5 -5
- data/test/acceptance/mocked_methods_dispatch_test.rb +4 -4
- data/test/acceptance/multiple_expectations_failure_message_test.rb +2 -2
- data/test/acceptance/optional_parameters_test.rb +5 -5
- data/test/acceptance/parameter_matcher_test.rb +18 -18
- data/test/acceptance/partial_mocks_test.rb +9 -9
- data/test/acceptance/raise_exception_test.rb +1 -1
- data/test/acceptance/return_value_test.rb +5 -5
- data/test/acceptance/sequence_test.rb +29 -29
- data/test/acceptance/states_test.rb +17 -17
- data/test/acceptance/stub_any_instance_method_test.rb +13 -13
- data/test/acceptance/stub_class_method_defined_on_active_record_association_proxy_test.rb +7 -7
- data/test/acceptance/stub_everything_test.rb +5 -5
- data/test/acceptance/stub_instance_method_defined_on_singleton_class_test.rb +1 -1
- data/test/acceptance/stub_module_method_test.rb +17 -17
- data/test/acceptance/stub_test.rb +5 -5
- data/test/acceptance/stubba_example_test.rb +24 -24
- data/test/acceptance/stubba_test_result_test.rb +11 -11
- data/test/acceptance/stubbing_error_backtrace_test.rb +6 -6
- data/test/acceptance/stubbing_frozen_object_test.rb +88 -0
- data/test/acceptance/stubbing_method_unnecessarily_test.rb +9 -9
- data/test/acceptance/stubbing_nil_test.rb +59 -0
- data/test/acceptance/stubbing_non_existent_any_instance_method_test.rb +13 -13
- data/test/acceptance/stubbing_non_existent_class_method_test.rb +15 -15
- data/test/acceptance/stubbing_non_existent_instance_method_test.rb +14 -14
- data/test/acceptance/stubbing_non_public_any_instance_method_test.rb +13 -13
- data/test/acceptance/stubbing_non_public_class_method_test.rb +12 -12
- data/test/acceptance/stubbing_non_public_instance_method_test.rb +12 -12
- data/test/acceptance/stubbing_on_non_mock_object_test.rb +9 -9
- data/test/acceptance/stubbing_same_class_method_on_parent_and_child_classes_test.rb +35 -0
- data/test/acceptance/throw_test.rb +1 -1
- data/test/deprecation_disabler.rb +1 -1
- data/test/execution_point.rb +7 -7
- data/test/method_definer.rb +1 -1
- data/test/mini_test_result.rb +21 -21
- data/test/simple_counter.rb +5 -5
- data/test/test_helper.rb +1 -1
- data/test/test_runner.rb +22 -24
- data/test/test_unit_result.rb +20 -0
- data/test/unit/any_instance_method_test.rb +28 -32
- data/test/unit/array_inspect_test.rb +3 -3
- data/test/unit/backtrace_filter_test.rb +3 -3
- data/test/unit/cardinality_test.rb +12 -12
- data/test/unit/central_test.rb +18 -18
- data/test/unit/change_state_side_effect_test.rb +12 -12
- data/test/unit/class_method_test.rb +33 -91
- data/test/unit/date_time_inspect_test.rb +4 -4
- data/test/unit/exception_raiser_test.rb +5 -5
- data/test/unit/expectation_list_test.rb +7 -7
- data/test/unit/expectation_test.rb +66 -66
- data/test/unit/hash_inspect_test.rb +4 -4
- data/test/unit/in_state_ordering_constraint_test.rb +13 -13
- data/test/unit/method_matcher_test.rb +3 -3
- data/test/unit/mock_test.rb +40 -40
- data/test/unit/mockery_test.rb +25 -25
- data/test/unit/multiple_yields_test.rb +2 -2
- data/test/unit/no_yields_test.rb +2 -2
- data/test/unit/object_inspect_test.rb +4 -4
- data/test/unit/object_test.rb +15 -15
- data/test/unit/parameter_matchers/all_of_test.rb +6 -6
- data/test/unit/parameter_matchers/any_of_test.rb +6 -6
- data/test/unit/parameter_matchers/anything_test.rb +5 -5
- data/test/unit/parameter_matchers/has_entries_test.rb +10 -10
- data/test/unit/parameter_matchers/has_entry_test.rb +13 -13
- data/test/unit/parameter_matchers/has_key_test.rb +11 -11
- data/test/unit/parameter_matchers/has_value_test.rb +12 -12
- data/test/unit/parameter_matchers/includes_test.rb +4 -4
- data/test/unit/parameter_matchers/not_test.rb +6 -6
- data/test/unit/parameter_matchers/regexp_matches_test.rb +9 -9
- data/test/unit/parameter_matchers/responds_with_test.rb +6 -6
- data/test/unit/parameter_matchers/stub_matcher.rb +4 -4
- data/test/unit/parameter_matchers/yaml_equivalent_test.rb +6 -6
- data/test/unit/parameters_matcher_test.rb +16 -16
- data/test/unit/return_values_test.rb +5 -5
- data/test/unit/sequence_test.rb +10 -10
- data/test/unit/single_return_value_test.rb +3 -3
- data/test/unit/single_yield_test.rb +2 -2
- data/test/unit/state_machine_test.rb +19 -19
- data/test/unit/string_inspect_test.rb +2 -2
- data/test/unit/thrower_test.rb +1 -1
- data/test/unit/yield_parameters_test.rb +11 -11
- metadata +113 -101
@@ -0,0 +1,246 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
2
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
3
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
4
|
+
<head>
|
5
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
6
|
+
<title>
|
7
|
+
Module: Mocha::ClassMethods
|
8
|
+
|
9
|
+
— Mocha 0.11.0
|
10
|
+
|
11
|
+
</title>
|
12
|
+
|
13
|
+
<link rel="stylesheet" href="../css/style.css" type="text/css" media="screen" charset="utf-8" />
|
14
|
+
|
15
|
+
<link rel="stylesheet" href="../css/common.css" type="text/css" media="screen" charset="utf-8" />
|
16
|
+
|
17
|
+
<script type="text/javascript" charset="utf-8">
|
18
|
+
relpath = '..';
|
19
|
+
if (relpath != '') relpath += '/';
|
20
|
+
</script>
|
21
|
+
|
22
|
+
<script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
|
23
|
+
|
24
|
+
<script type="text/javascript" charset="utf-8" src="../js/app.js"></script>
|
25
|
+
|
26
|
+
|
27
|
+
</head>
|
28
|
+
<body>
|
29
|
+
<script type="text/javascript" charset="utf-8">
|
30
|
+
if (window.top.frames.main) document.body.className = 'frames';
|
31
|
+
</script>
|
32
|
+
|
33
|
+
<div id="header">
|
34
|
+
<div id="menu">
|
35
|
+
|
36
|
+
<a href="../_index.html">Index (C)</a> »
|
37
|
+
<span class='title'><span class='object_link'><a href="../Mocha.html" title="Mocha (module)">Mocha</a></span></span>
|
38
|
+
»
|
39
|
+
<span class="title">ClassMethods</span>
|
40
|
+
|
41
|
+
|
42
|
+
<div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
|
43
|
+
</div>
|
44
|
+
|
45
|
+
<div id="search">
|
46
|
+
|
47
|
+
<a id="class_list_link" href="#">Class List</a>
|
48
|
+
|
49
|
+
<a id="method_list_link" href="#">Method List</a>
|
50
|
+
|
51
|
+
<a id="file_list_link" href="#">File List</a>
|
52
|
+
|
53
|
+
</div>
|
54
|
+
<div class="clear"></div>
|
55
|
+
</div>
|
56
|
+
|
57
|
+
<iframe id="search_frame"></iframe>
|
58
|
+
|
59
|
+
<div id="content"><h1>Module: Mocha::ClassMethods
|
60
|
+
|
61
|
+
|
62
|
+
|
63
|
+
</h1>
|
64
|
+
|
65
|
+
<dl class="box">
|
66
|
+
|
67
|
+
|
68
|
+
|
69
|
+
|
70
|
+
|
71
|
+
|
72
|
+
|
73
|
+
|
74
|
+
<dt class="r1 last">Defined in:</dt>
|
75
|
+
<dd class="r1 last">lib/mocha/object.rb</dd>
|
76
|
+
|
77
|
+
</dl>
|
78
|
+
<div class="clear"></div>
|
79
|
+
|
80
|
+
<h2>Overview</h2><div class="docstring">
|
81
|
+
<div class="discussion">
|
82
|
+
|
83
|
+
<p>Methods added to all classes to allow mocking and stubbing on real (i.e.
|
84
|
+
non-mock) objects.</p>
|
85
|
+
|
86
|
+
|
87
|
+
</div>
|
88
|
+
</div>
|
89
|
+
<div class="tags">
|
90
|
+
|
91
|
+
|
92
|
+
</div>
|
93
|
+
|
94
|
+
|
95
|
+
|
96
|
+
|
97
|
+
|
98
|
+
|
99
|
+
|
100
|
+
<h2>
|
101
|
+
Instance Method Summary
|
102
|
+
<small>(<a href="#" class="summary_toggle">collapse</a>)</small>
|
103
|
+
</h2>
|
104
|
+
|
105
|
+
<ul class="summary">
|
106
|
+
|
107
|
+
<li class="public ">
|
108
|
+
<span class="summary_signature">
|
109
|
+
|
110
|
+
<a href="#any_instance-instance_method" title="#any_instance (instance method)">- (Mock) <strong>any_instance</strong> </a>
|
111
|
+
|
112
|
+
|
113
|
+
|
114
|
+
</span>
|
115
|
+
|
116
|
+
|
117
|
+
|
118
|
+
|
119
|
+
|
120
|
+
|
121
|
+
|
122
|
+
|
123
|
+
<span class="summary_desc"><div class='inline'>
|
124
|
+
<p>A mock object which will detect calls to any instance of this class.</p>
|
125
|
+
</div></span>
|
126
|
+
|
127
|
+
</li>
|
128
|
+
|
129
|
+
|
130
|
+
</ul>
|
131
|
+
|
132
|
+
|
133
|
+
|
134
|
+
|
135
|
+
<div id="instance_method_details" class="method_details_list">
|
136
|
+
<h2>Instance Method Details</h2>
|
137
|
+
|
138
|
+
|
139
|
+
<div class="method_details first">
|
140
|
+
<p class="signature first" id="any_instance-instance_method">
|
141
|
+
|
142
|
+
- (<tt><span class='object_link'><a href="Mock.html" title="Mocha::Mock (class)">Mock</a></span></tt>) <strong>any_instance</strong>
|
143
|
+
|
144
|
+
|
145
|
+
|
146
|
+
</p><div class="docstring">
|
147
|
+
<div class="discussion">
|
148
|
+
|
149
|
+
<p>A mock object which will detect calls to any instance of this class.</p>
|
150
|
+
|
151
|
+
|
152
|
+
</div>
|
153
|
+
</div>
|
154
|
+
<div class="tags">
|
155
|
+
|
156
|
+
<div class="examples">
|
157
|
+
<h3>Examples:</h3>
|
158
|
+
|
159
|
+
<h4><div class='inline'>
|
160
|
+
<p>Return false to invocation of <tt>Product#save</tt> for any instance of
|
161
|
+
<tt>Product</tt>.</p>
|
162
|
+
</div></h4>
|
163
|
+
<pre class="example code"><span class='const'>Product</span><span class='period'>.</span><span class='id identifier rubyid_any_instance'>any_instance</span><span class='period'>.</span><span class='id identifier rubyid_stubs'>stubs</span><span class='lparen'>(</span><span class='symbol'>:save</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_returns'>returns</span><span class='lparen'>(</span><span class='kw'>false</span><span class='rparen'>)</span>
|
164
|
+
<span class='id identifier rubyid_product_1'>product_1</span> <span class='op'>=</span> <span class='const'>Product</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span>
|
165
|
+
<span class='id identifier rubyid_assert_equal'>assert_equal</span> <span class='kw'>false</span><span class='comma'>,</span> <span class='id identifier rubyid_product_1'>product_1</span><span class='period'>.</span><span class='id identifier rubyid_save'>save</span>
|
166
|
+
<span class='id identifier rubyid_product_2'>product_2</span> <span class='op'>=</span> <span class='const'>Product</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span>
|
167
|
+
<span class='id identifier rubyid_assert_equal'>assert_equal</span> <span class='kw'>false</span><span class='comma'>,</span> <span class='id identifier rubyid_product_2'>product_2</span><span class='period'>.</span><span class='id identifier rubyid_save'>save</span></pre>
|
168
|
+
|
169
|
+
</div>
|
170
|
+
|
171
|
+
<h3>Returns:</h3>
|
172
|
+
<ul class="return">
|
173
|
+
|
174
|
+
<li>
|
175
|
+
|
176
|
+
|
177
|
+
<span class='type'>(<tt><span class='object_link'><a href="Mock.html" title="Mocha::Mock (class)">Mock</a></span></tt>)</span>
|
178
|
+
|
179
|
+
|
180
|
+
|
181
|
+
—
|
182
|
+
<div class='inline'>
|
183
|
+
<p>a mock object which will detect calls to any instance of this class.</p>
|
184
|
+
</div>
|
185
|
+
|
186
|
+
</li>
|
187
|
+
|
188
|
+
</ul>
|
189
|
+
<h3>Raises:</h3>
|
190
|
+
<ul class="raise">
|
191
|
+
|
192
|
+
<li>
|
193
|
+
|
194
|
+
|
195
|
+
<span class='type'>(<tt><span class='object_link'><a href="StubbingError.html" title="Mocha::StubbingError (class)">StubbingError</a></span></tt>)</span>
|
196
|
+
|
197
|
+
|
198
|
+
|
199
|
+
—
|
200
|
+
<div class='inline'>
|
201
|
+
<p>if attempting to stub method which is not allowed.</p>
|
202
|
+
</div>
|
203
|
+
|
204
|
+
</li>
|
205
|
+
|
206
|
+
</ul>
|
207
|
+
|
208
|
+
</div><table class="source_code">
|
209
|
+
<tr>
|
210
|
+
<td>
|
211
|
+
<pre class="lines">
|
212
|
+
|
213
|
+
|
214
|
+
228
|
215
|
+
229
|
216
|
+
230
|
217
|
+
231
|
218
|
+
232
|
219
|
+
233</pre>
|
220
|
+
</td>
|
221
|
+
<td>
|
222
|
+
<pre class="code"><span class="info file"># File 'lib/mocha/object.rb', line 228</span>
|
223
|
+
|
224
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_any_instance'>any_instance</span>
|
225
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_frozen?'>frozen?</span>
|
226
|
+
<span class='id identifier rubyid_raise'>raise</span> <span class='const'>StubbingError</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>can't stub method on frozen object: </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_mocha_inspect'>mocha_inspect</span><span class='rbrace'>}</span><span class='tstring_content'>.any_instance</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='id identifier rubyid_caller'>caller</span><span class='rparen'>)</span>
|
227
|
+
<span class='kw'>end</span>
|
228
|
+
<span class='ivar'>@any_instance</span> <span class='op'>||=</span> <span class='const'>AnyInstance</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='kw'>self</span><span class='rparen'>)</span>
|
229
|
+
<span class='kw'>end</span></pre>
|
230
|
+
</td>
|
231
|
+
</tr>
|
232
|
+
</table>
|
233
|
+
</div>
|
234
|
+
|
235
|
+
</div>
|
236
|
+
|
237
|
+
</div>
|
238
|
+
|
239
|
+
<div id="footer">
|
240
|
+
Generated on Thu Apr 19 10:54:34 2012 by
|
241
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
242
|
+
0.7.5 (ruby-1.9.3).
|
243
|
+
</div>
|
244
|
+
|
245
|
+
</body>
|
246
|
+
</html>
|
@@ -0,0 +1,471 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
2
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
3
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
4
|
+
<head>
|
5
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
6
|
+
<title>
|
7
|
+
Class: Mocha::Configuration
|
8
|
+
|
9
|
+
— Mocha 0.11.0
|
10
|
+
|
11
|
+
</title>
|
12
|
+
|
13
|
+
<link rel="stylesheet" href="../css/style.css" type="text/css" media="screen" charset="utf-8" />
|
14
|
+
|
15
|
+
<link rel="stylesheet" href="../css/common.css" type="text/css" media="screen" charset="utf-8" />
|
16
|
+
|
17
|
+
<script type="text/javascript" charset="utf-8">
|
18
|
+
relpath = '..';
|
19
|
+
if (relpath != '') relpath += '/';
|
20
|
+
</script>
|
21
|
+
|
22
|
+
<script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
|
23
|
+
|
24
|
+
<script type="text/javascript" charset="utf-8" src="../js/app.js"></script>
|
25
|
+
|
26
|
+
|
27
|
+
</head>
|
28
|
+
<body>
|
29
|
+
<script type="text/javascript" charset="utf-8">
|
30
|
+
if (window.top.frames.main) document.body.className = 'frames';
|
31
|
+
</script>
|
32
|
+
|
33
|
+
<div id="header">
|
34
|
+
<div id="menu">
|
35
|
+
|
36
|
+
<a href="../_index.html">Index (C)</a> »
|
37
|
+
<span class='title'><span class='object_link'><a href="../Mocha.html" title="Mocha (module)">Mocha</a></span></span>
|
38
|
+
»
|
39
|
+
<span class="title">Configuration</span>
|
40
|
+
|
41
|
+
|
42
|
+
<div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
|
43
|
+
</div>
|
44
|
+
|
45
|
+
<div id="search">
|
46
|
+
|
47
|
+
<a id="class_list_link" href="#">Class List</a>
|
48
|
+
|
49
|
+
<a id="method_list_link" href="#">Method List</a>
|
50
|
+
|
51
|
+
<a id="file_list_link" href="#">File List</a>
|
52
|
+
|
53
|
+
</div>
|
54
|
+
<div class="clear"></div>
|
55
|
+
</div>
|
56
|
+
|
57
|
+
<iframe id="search_frame"></iframe>
|
58
|
+
|
59
|
+
<div id="content"><h1>Class: Mocha::Configuration
|
60
|
+
|
61
|
+
|
62
|
+
|
63
|
+
</h1>
|
64
|
+
|
65
|
+
<dl class="box">
|
66
|
+
|
67
|
+
<dt class="r1">Inherits:</dt>
|
68
|
+
<dd class="r1">
|
69
|
+
<span class="inheritName"><span class='object_link'><a href="../Object.html" title="Object (class)">Object</a></span></span>
|
70
|
+
|
71
|
+
<ul class="fullTree">
|
72
|
+
<li><span class='object_link'><a href="../Object.html" title="Object (class)">Object</a></span></li>
|
73
|
+
|
74
|
+
<li class="next">Mocha::Configuration</li>
|
75
|
+
|
76
|
+
</ul>
|
77
|
+
<a href="#" class="inheritanceTree">show all</a>
|
78
|
+
|
79
|
+
</dd>
|
80
|
+
|
81
|
+
|
82
|
+
|
83
|
+
|
84
|
+
|
85
|
+
|
86
|
+
|
87
|
+
|
88
|
+
|
89
|
+
<dt class="r2 last">Defined in:</dt>
|
90
|
+
<dd class="r2 last">lib/mocha/configuration.rb</dd>
|
91
|
+
|
92
|
+
</dl>
|
93
|
+
<div class="clear"></div>
|
94
|
+
|
95
|
+
<h2>Overview</h2><div class="docstring">
|
96
|
+
<div class="discussion">
|
97
|
+
|
98
|
+
<p>Configuration settings.</p>
|
99
|
+
|
100
|
+
|
101
|
+
</div>
|
102
|
+
</div>
|
103
|
+
<div class="tags">
|
104
|
+
|
105
|
+
|
106
|
+
</div>
|
107
|
+
<h2>Constant Summary</h2>
|
108
|
+
|
109
|
+
<dl class="constants">
|
110
|
+
|
111
|
+
<dt id="DEFAULTS-constant" class="">DEFAULTS =
|
112
|
+
|
113
|
+
</dt>
|
114
|
+
<dd><pre class="code"><span class='lbrace'>{</span>
|
115
|
+
<span class='symbol'>:stubbing_method_unnecessarily</span> <span class='op'>=></span> <span class='symbol'>:allow</span><span class='comma'>,</span>
|
116
|
+
<span class='symbol'>:stubbing_method_on_non_mock_object</span> <span class='op'>=></span> <span class='symbol'>:allow</span><span class='comma'>,</span>
|
117
|
+
<span class='symbol'>:stubbing_non_existent_method</span> <span class='op'>=></span> <span class='symbol'>:allow</span><span class='comma'>,</span>
|
118
|
+
<span class='symbol'>:stubbing_non_public_method</span> <span class='op'>=></span> <span class='symbol'>:allow</span><span class='comma'>,</span>
|
119
|
+
<span class='symbol'>:stubbing_method_on_nil</span> <span class='op'>=></span> <span class='symbol'>:prevent</span><span class='comma'>,</span>
|
120
|
+
<span class='rbrace'>}</span></pre></dd>
|
121
|
+
|
122
|
+
</dl>
|
123
|
+
|
124
|
+
|
125
|
+
|
126
|
+
|
127
|
+
|
128
|
+
|
129
|
+
|
130
|
+
|
131
|
+
|
132
|
+
<h2>
|
133
|
+
Class Method Summary
|
134
|
+
<small>(<a href="#" class="summary_toggle">collapse</a>)</small>
|
135
|
+
</h2>
|
136
|
+
|
137
|
+
<ul class="summary">
|
138
|
+
|
139
|
+
<li class="public ">
|
140
|
+
<span class="summary_signature">
|
141
|
+
|
142
|
+
<a href="#allow-class_method" title="allow (class method)">+ (Object) <strong>allow</strong>(action) { ... }</a>
|
143
|
+
|
144
|
+
|
145
|
+
|
146
|
+
</span>
|
147
|
+
|
148
|
+
|
149
|
+
|
150
|
+
|
151
|
+
|
152
|
+
|
153
|
+
|
154
|
+
|
155
|
+
<span class="summary_desc"><div class='inline'>
|
156
|
+
<p>Allow the specified <tt>action</tt>.</p>
|
157
|
+
</div></span>
|
158
|
+
|
159
|
+
</li>
|
160
|
+
|
161
|
+
|
162
|
+
<li class="public ">
|
163
|
+
<span class="summary_signature">
|
164
|
+
|
165
|
+
<a href="#prevent-class_method" title="prevent (class method)">+ (Object) <strong>prevent</strong>(action) { ... }</a>
|
166
|
+
|
167
|
+
|
168
|
+
|
169
|
+
</span>
|
170
|
+
|
171
|
+
|
172
|
+
|
173
|
+
|
174
|
+
|
175
|
+
|
176
|
+
|
177
|
+
|
178
|
+
<span class="summary_desc"><div class='inline'>
|
179
|
+
<p>Raise a <span class='object_link'><a href="StubbingError.html" title="Mocha::StubbingError (class)">StubbingError</a></span> if if the specified <tt>action</tt> is attempted.</p>
|
180
|
+
</div></span>
|
181
|
+
|
182
|
+
</li>
|
183
|
+
|
184
|
+
|
185
|
+
<li class="public ">
|
186
|
+
<span class="summary_signature">
|
187
|
+
|
188
|
+
<a href="#warn_when-class_method" title="warn_when (class method)">+ (Object) <strong>warn_when</strong>(action) { ... }</a>
|
189
|
+
|
190
|
+
|
191
|
+
|
192
|
+
</span>
|
193
|
+
|
194
|
+
|
195
|
+
|
196
|
+
|
197
|
+
|
198
|
+
|
199
|
+
|
200
|
+
|
201
|
+
<span class="summary_desc"><div class='inline'>
|
202
|
+
<p>Warn if the specified <tt>action</tt> is attempted.</p>
|
203
|
+
</div></span>
|
204
|
+
|
205
|
+
</li>
|
206
|
+
|
207
|
+
|
208
|
+
</ul>
|
209
|
+
|
210
|
+
|
211
|
+
|
212
|
+
|
213
|
+
<div id="class_method_details" class="method_details_list">
|
214
|
+
<h2>Class Method Details</h2>
|
215
|
+
|
216
|
+
|
217
|
+
<div class="method_details first">
|
218
|
+
<p class="signature first" id="allow-class_method">
|
219
|
+
|
220
|
+
+ (<tt><span class='object_link'><a href="../Object.html" title="Object (class)">Object</a></span></tt>) <strong>allow</strong>(action) { ... }
|
221
|
+
|
222
|
+
|
223
|
+
|
224
|
+
</p><div class="docstring">
|
225
|
+
<div class="discussion">
|
226
|
+
|
227
|
+
<p>Allow the specified <tt>action</tt>.</p>
|
228
|
+
|
229
|
+
|
230
|
+
</div>
|
231
|
+
</div>
|
232
|
+
<div class="tags">
|
233
|
+
<h3>Parameters:</h3>
|
234
|
+
<ul class="param">
|
235
|
+
|
236
|
+
<li>
|
237
|
+
|
238
|
+
<span class='name'>action</span>
|
239
|
+
|
240
|
+
|
241
|
+
<span class='type'>(<tt>Symbol</tt>)</span>
|
242
|
+
|
243
|
+
|
244
|
+
|
245
|
+
—
|
246
|
+
<div class='inline'>
|
247
|
+
<p>one of <tt>:stubbing_method_unnecessarily</tt>,
|
248
|
+
<tt>:stubbing_method_on_non_mock_object</tt>,
|
249
|
+
<tt>:stubbing_non_existent_method</tt>,
|
250
|
+
<tt>:stubbing_non_public_method</tt>, <tt>:stubbing_method_on_nil</tt>.</p>
|
251
|
+
</div>
|
252
|
+
|
253
|
+
</li>
|
254
|
+
|
255
|
+
</ul>
|
256
|
+
|
257
|
+
<h3>Yields:</h3>
|
258
|
+
<ul class="yield">
|
259
|
+
|
260
|
+
<li>
|
261
|
+
|
262
|
+
|
263
|
+
<span class='type'></span>
|
264
|
+
|
265
|
+
|
266
|
+
|
267
|
+
|
268
|
+
<div class='inline'>
|
269
|
+
<p>optional block during which the configuration change will be changed before
|
270
|
+
being returned to its original value at the end of the block.</p>
|
271
|
+
</div>
|
272
|
+
|
273
|
+
</li>
|
274
|
+
|
275
|
+
</ul>
|
276
|
+
|
277
|
+
</div><table class="source_code">
|
278
|
+
<tr>
|
279
|
+
<td>
|
280
|
+
<pre class="lines">
|
281
|
+
|
282
|
+
|
283
|
+
20
|
284
|
+
21
|
285
|
+
22</pre>
|
286
|
+
</td>
|
287
|
+
<td>
|
288
|
+
<pre class="code"><span class="info file"># File 'lib/mocha/configuration.rb', line 20</span>
|
289
|
+
|
290
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_allow'>allow</span><span class='lparen'>(</span><span class='id identifier rubyid_action'>action</span><span class='comma'>,</span> <span class='op'>&</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
|
291
|
+
<span class='id identifier rubyid_change_config'>change_config</span> <span class='id identifier rubyid_action'>action</span><span class='comma'>,</span> <span class='symbol'>:allow</span><span class='comma'>,</span> <span class='op'>&</span><span class='id identifier rubyid_block'>block</span>
|
292
|
+
<span class='kw'>end</span></pre>
|
293
|
+
</td>
|
294
|
+
</tr>
|
295
|
+
</table>
|
296
|
+
</div>
|
297
|
+
|
298
|
+
<div class="method_details ">
|
299
|
+
<p class="signature " id="prevent-class_method">
|
300
|
+
|
301
|
+
+ (<tt><span class='object_link'><a href="../Object.html" title="Object (class)">Object</a></span></tt>) <strong>prevent</strong>(action) { ... }
|
302
|
+
|
303
|
+
|
304
|
+
|
305
|
+
</p><div class="docstring">
|
306
|
+
<div class="discussion">
|
307
|
+
|
308
|
+
<p>Raise a <span class='object_link'><a href="StubbingError.html" title="Mocha::StubbingError (class)">StubbingError</a></span> if if the specified <tt>action</tt> is attempted.</p>
|
309
|
+
|
310
|
+
|
311
|
+
</div>
|
312
|
+
</div>
|
313
|
+
<div class="tags">
|
314
|
+
<h3>Parameters:</h3>
|
315
|
+
<ul class="param">
|
316
|
+
|
317
|
+
<li>
|
318
|
+
|
319
|
+
<span class='name'>action</span>
|
320
|
+
|
321
|
+
|
322
|
+
<span class='type'>(<tt>Symbol</tt>)</span>
|
323
|
+
|
324
|
+
|
325
|
+
|
326
|
+
—
|
327
|
+
<div class='inline'>
|
328
|
+
<p>one of <tt>:stubbing_method_unnecessarily</tt>,
|
329
|
+
<tt>:stubbing_method_on_non_mock_object</tt>,
|
330
|
+
<tt>:stubbing_non_existent_method</tt>,
|
331
|
+
<tt>:stubbing_non_public_method</tt>, <tt>:stubbing_method_on_nil</tt>.</p>
|
332
|
+
</div>
|
333
|
+
|
334
|
+
</li>
|
335
|
+
|
336
|
+
</ul>
|
337
|
+
|
338
|
+
<h3>Yields:</h3>
|
339
|
+
<ul class="yield">
|
340
|
+
|
341
|
+
<li>
|
342
|
+
|
343
|
+
|
344
|
+
<span class='type'></span>
|
345
|
+
|
346
|
+
|
347
|
+
|
348
|
+
|
349
|
+
<div class='inline'>
|
350
|
+
<p>optional block during which the configuration change will be changed before
|
351
|
+
being returned to its original value at the end of the block.</p>
|
352
|
+
</div>
|
353
|
+
|
354
|
+
</li>
|
355
|
+
|
356
|
+
</ul>
|
357
|
+
|
358
|
+
</div><table class="source_code">
|
359
|
+
<tr>
|
360
|
+
<td>
|
361
|
+
<pre class="lines">
|
362
|
+
|
363
|
+
|
364
|
+
46
|
365
|
+
47
|
366
|
+
48</pre>
|
367
|
+
</td>
|
368
|
+
<td>
|
369
|
+
<pre class="code"><span class="info file"># File 'lib/mocha/configuration.rb', line 46</span>
|
370
|
+
|
371
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_prevent'>prevent</span><span class='lparen'>(</span><span class='id identifier rubyid_action'>action</span><span class='comma'>,</span> <span class='op'>&</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
|
372
|
+
<span class='id identifier rubyid_change_config'>change_config</span> <span class='id identifier rubyid_action'>action</span><span class='comma'>,</span> <span class='symbol'>:prevent</span><span class='comma'>,</span> <span class='op'>&</span><span class='id identifier rubyid_block'>block</span>
|
373
|
+
<span class='kw'>end</span></pre>
|
374
|
+
</td>
|
375
|
+
</tr>
|
376
|
+
</table>
|
377
|
+
</div>
|
378
|
+
|
379
|
+
<div class="method_details ">
|
380
|
+
<p class="signature " id="warn_when-class_method">
|
381
|
+
|
382
|
+
+ (<tt><span class='object_link'><a href="../Object.html" title="Object (class)">Object</a></span></tt>) <strong>warn_when</strong>(action) { ... }
|
383
|
+
|
384
|
+
|
385
|
+
|
386
|
+
</p><div class="docstring">
|
387
|
+
<div class="discussion">
|
388
|
+
|
389
|
+
<p>Warn if the specified <tt>action</tt> is attempted.</p>
|
390
|
+
|
391
|
+
|
392
|
+
</div>
|
393
|
+
</div>
|
394
|
+
<div class="tags">
|
395
|
+
<h3>Parameters:</h3>
|
396
|
+
<ul class="param">
|
397
|
+
|
398
|
+
<li>
|
399
|
+
|
400
|
+
<span class='name'>action</span>
|
401
|
+
|
402
|
+
|
403
|
+
<span class='type'>(<tt>Symbol</tt>)</span>
|
404
|
+
|
405
|
+
|
406
|
+
|
407
|
+
—
|
408
|
+
<div class='inline'>
|
409
|
+
<p>one of <tt>:stubbing_method_unnecessarily</tt>,
|
410
|
+
<tt>:stubbing_method_on_non_mock_object</tt>,
|
411
|
+
<tt>:stubbing_non_existent_method</tt>,
|
412
|
+
<tt>:stubbing_non_public_method</tt>, <tt>:stubbing_method_on_nil</tt>.</p>
|
413
|
+
</div>
|
414
|
+
|
415
|
+
</li>
|
416
|
+
|
417
|
+
</ul>
|
418
|
+
|
419
|
+
<h3>Yields:</h3>
|
420
|
+
<ul class="yield">
|
421
|
+
|
422
|
+
<li>
|
423
|
+
|
424
|
+
|
425
|
+
<span class='type'></span>
|
426
|
+
|
427
|
+
|
428
|
+
|
429
|
+
|
430
|
+
<div class='inline'>
|
431
|
+
<p>optional block during which the configuration change will be changed before
|
432
|
+
being returned to its original value at the end of the block.</p>
|
433
|
+
</div>
|
434
|
+
|
435
|
+
</li>
|
436
|
+
|
437
|
+
</ul>
|
438
|
+
|
439
|
+
</div><table class="source_code">
|
440
|
+
<tr>
|
441
|
+
<td>
|
442
|
+
<pre class="lines">
|
443
|
+
|
444
|
+
|
445
|
+
33
|
446
|
+
34
|
447
|
+
35</pre>
|
448
|
+
</td>
|
449
|
+
<td>
|
450
|
+
<pre class="code"><span class="info file"># File 'lib/mocha/configuration.rb', line 33</span>
|
451
|
+
|
452
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_warn_when'>warn_when</span><span class='lparen'>(</span><span class='id identifier rubyid_action'>action</span><span class='comma'>,</span> <span class='op'>&</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
|
453
|
+
<span class='id identifier rubyid_change_config'>change_config</span> <span class='id identifier rubyid_action'>action</span><span class='comma'>,</span> <span class='symbol'>:warn</span><span class='comma'>,</span> <span class='op'>&</span><span class='id identifier rubyid_block'>block</span>
|
454
|
+
<span class='kw'>end</span></pre>
|
455
|
+
</td>
|
456
|
+
</tr>
|
457
|
+
</table>
|
458
|
+
</div>
|
459
|
+
|
460
|
+
</div>
|
461
|
+
|
462
|
+
</div>
|
463
|
+
|
464
|
+
<div id="footer">
|
465
|
+
Generated on Thu Apr 19 10:54:34 2012 by
|
466
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
467
|
+
0.7.5 (ruby-1.9.3).
|
468
|
+
</div>
|
469
|
+
|
470
|
+
</body>
|
471
|
+
</html>
|