mocha 1.7.0 → 1.8.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 +4 -9
- data/README.md +17 -16
- data/RELEASE.md +10 -0
- data/Rakefile +6 -13
- data/bin/build-matrix +16 -2
- data/docs/CNAME +1 -0
- data/docs/Mocha.html +127 -0
- data/docs/Mocha/API.html +1056 -0
- data/docs/Mocha/ClassMethods.html +267 -0
- data/docs/Mocha/Configuration.html +626 -0
- data/docs/Mocha/Expectation.html +2709 -0
- data/docs/Mocha/ExpectationError.html +157 -0
- data/docs/Mocha/ExpectationErrorFactory.html +269 -0
- data/docs/Mocha/Hooks.html +385 -0
- data/docs/Mocha/Integration.html +125 -0
- data/docs/Mocha/Integration/MiniTest.html +123 -0
- data/docs/Mocha/Integration/MiniTest/Adapter.html +165 -0
- data/docs/Mocha/Integration/TestUnit.html +123 -0
- data/docs/Mocha/Integration/TestUnit/Adapter.html +165 -0
- data/docs/Mocha/Mock.html +1197 -0
- data/docs/Mocha/ObjectMethods.html +712 -0
- data/docs/Mocha/ParameterMatchers.html +3049 -0
- data/docs/Mocha/ParameterMatchers/AllOf.html +154 -0
- data/docs/Mocha/ParameterMatchers/AnyOf.html +154 -0
- data/docs/Mocha/ParameterMatchers/AnyParameters.html +153 -0
- data/docs/Mocha/ParameterMatchers/Anything.html +153 -0
- data/docs/Mocha/ParameterMatchers/Base.html +448 -0
- data/docs/Mocha/ParameterMatchers/Equals.html +154 -0
- data/docs/Mocha/ParameterMatchers/EquivalentUri.html +153 -0
- data/docs/Mocha/ParameterMatchers/HasEntries.html +154 -0
- data/docs/Mocha/ParameterMatchers/HasEntry.html +154 -0
- data/docs/Mocha/ParameterMatchers/HasKey.html +154 -0
- data/docs/Mocha/ParameterMatchers/HasValue.html +154 -0
- data/docs/Mocha/ParameterMatchers/Includes.html +154 -0
- data/docs/Mocha/ParameterMatchers/InstanceOf.html +154 -0
- data/docs/Mocha/ParameterMatchers/IsA.html +153 -0
- data/docs/Mocha/ParameterMatchers/KindOf.html +154 -0
- data/docs/Mocha/ParameterMatchers/Not.html +154 -0
- data/docs/Mocha/ParameterMatchers/Optionally.html +153 -0
- data/docs/Mocha/ParameterMatchers/RegexpMatches.html +154 -0
- data/docs/Mocha/ParameterMatchers/RespondsWith.html +154 -0
- data/docs/Mocha/ParameterMatchers/YamlEquivalent.html +154 -0
- data/docs/Mocha/Sequence.html +149 -0
- data/docs/Mocha/StateMachine.html +539 -0
- data/docs/Mocha/StateMachine/State.html +141 -0
- data/docs/Mocha/StateMachine/StatePredicate.html +141 -0
- data/docs/Mocha/StubbingError.html +150 -0
- data/docs/Mocha/UnexpectedInvocation.html +140 -0
- data/docs/_index.html +537 -0
- data/docs/class_list.html +51 -0
- data/docs/css/common.css +1 -0
- data/docs/css/full_list.css +58 -0
- data/docs/css/style.css +496 -0
- data/docs/file.COPYING.html +81 -0
- data/docs/file.MIT-LICENSE.html +85 -0
- data/docs/file.README.html +418 -0
- data/docs/file.RELEASE.html +875 -0
- data/docs/file_list.html +71 -0
- data/docs/frames.html +17 -0
- data/docs/index.html +418 -0
- data/docs/js/app.js +292 -0
- data/docs/js/full_list.js +216 -0
- data/docs/js/jquery.js +4 -0
- data/docs/method_list.html +571 -0
- data/docs/top-level-namespace.html +118 -0
- data/lib/mocha/inspect.rb +1 -1
- data/lib/mocha/version.rb +1 -1
- data/mocha.gemspec +2 -3
- data/test/unit/object_inspect_test.rb +10 -0
- data/yard-templates/default/layout/html/google_analytics.erb +6 -9
- metadata +68 -36
@@ -0,0 +1,157 @@
|
|
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
|
+
Exception: Mocha::ExpectationError
|
8
|
+
|
9
|
+
— Mocha 1.8.0
|
10
|
+
|
11
|
+
</title>
|
12
|
+
|
13
|
+
<link rel="stylesheet" href="../css/style.css" type="text/css" charset="utf-8" />
|
14
|
+
|
15
|
+
<link rel="stylesheet" href="../css/common.css" type="text/css" charset="utf-8" />
|
16
|
+
|
17
|
+
<script type="text/javascript" charset="utf-8">
|
18
|
+
pathId = "Mocha::ExpectationError";
|
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 (E)</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">ExpectationError</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>Exception: Mocha::ExpectationError
|
63
|
+
|
64
|
+
|
65
|
+
|
66
|
+
</h1>
|
67
|
+
<div class="box_info">
|
68
|
+
|
69
|
+
<dl>
|
70
|
+
<dt>Inherits:</dt>
|
71
|
+
<dd>
|
72
|
+
<span class="inheritName">Exception</span>
|
73
|
+
|
74
|
+
<ul class="fullTree">
|
75
|
+
<li><span class='object_link'>Object</span></li>
|
76
|
+
|
77
|
+
<li class="next">Exception</li>
|
78
|
+
|
79
|
+
<li class="next">Mocha::ExpectationError</li>
|
80
|
+
|
81
|
+
</ul>
|
82
|
+
<a href="#" class="inheritanceTree">show all</a>
|
83
|
+
|
84
|
+
</dd>
|
85
|
+
</dl>
|
86
|
+
|
87
|
+
|
88
|
+
|
89
|
+
|
90
|
+
|
91
|
+
|
92
|
+
|
93
|
+
|
94
|
+
|
95
|
+
|
96
|
+
|
97
|
+
<dl>
|
98
|
+
<dt>Defined in:</dt>
|
99
|
+
<dd>lib/mocha/expectation_error.rb</dd>
|
100
|
+
</dl>
|
101
|
+
|
102
|
+
</div>
|
103
|
+
|
104
|
+
<h2>Overview</h2><div class="docstring">
|
105
|
+
<div class="discussion">
|
106
|
+
|
107
|
+
<p>Default exception class raised when an unexpected invocation or an
|
108
|
+
unsatisfied expectation occurs.</p>
|
109
|
+
|
110
|
+
<p>Authors of test libraries may use
|
111
|
+
<code>Mocha::ExpectationErrorFactory</code> to have Mocha raise a different
|
112
|
+
exception.</p>
|
113
|
+
|
114
|
+
<p>rubocop:disable Lint/InheritException</p>
|
115
|
+
|
116
|
+
|
117
|
+
</div>
|
118
|
+
</div>
|
119
|
+
<div class="tags">
|
120
|
+
|
121
|
+
|
122
|
+
<p class="tag_title">See Also:</p>
|
123
|
+
<ul class="see">
|
124
|
+
|
125
|
+
<li><span class='object_link'><a href="ExpectationErrorFactory.html" title="Mocha::ExpectationErrorFactory (class)">ExpectationErrorFactory</a></span></li>
|
126
|
+
|
127
|
+
</ul>
|
128
|
+
|
129
|
+
</div>
|
130
|
+
|
131
|
+
|
132
|
+
|
133
|
+
|
134
|
+
|
135
|
+
|
136
|
+
|
137
|
+
|
138
|
+
|
139
|
+
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-625523-7"></script>
|
140
|
+
<script>
|
141
|
+
window.dataLayer = window.dataLayer || [];
|
142
|
+
function gtag(){dataLayer.push(arguments);}
|
143
|
+
gtag('js', new Date());
|
144
|
+
|
145
|
+
gtag('config', 'UA-625523-7');
|
146
|
+
</script>
|
147
|
+
</div>
|
148
|
+
|
149
|
+
<div id="footer">
|
150
|
+
Generated on Tue Jan 15 17:13:06 2019 by
|
151
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
152
|
+
0.9.16 (ruby-2.5.3).
|
153
|
+
</div>
|
154
|
+
|
155
|
+
</div>
|
156
|
+
</body>
|
157
|
+
</html>
|
@@ -0,0 +1,269 @@
|
|
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
|
+
Class: Mocha::ExpectationErrorFactory
|
8
|
+
|
9
|
+
— Mocha 1.8.0
|
10
|
+
|
11
|
+
</title>
|
12
|
+
|
13
|
+
<link rel="stylesheet" href="../css/style.css" type="text/css" charset="utf-8" />
|
14
|
+
|
15
|
+
<link rel="stylesheet" href="../css/common.css" type="text/css" charset="utf-8" />
|
16
|
+
|
17
|
+
<script type="text/javascript" charset="utf-8">
|
18
|
+
pathId = "Mocha::ExpectationErrorFactory";
|
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 (E)</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">ExpectationErrorFactory</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>Class: Mocha::ExpectationErrorFactory
|
63
|
+
|
64
|
+
|
65
|
+
|
66
|
+
</h1>
|
67
|
+
<div class="box_info">
|
68
|
+
|
69
|
+
<dl>
|
70
|
+
<dt>Inherits:</dt>
|
71
|
+
<dd>
|
72
|
+
<span class="inheritName"><span class='object_link'>Object</span></span>
|
73
|
+
|
74
|
+
<ul class="fullTree">
|
75
|
+
<li><span class='object_link'>Object</span></li>
|
76
|
+
|
77
|
+
<li class="next">Mocha::ExpectationErrorFactory</li>
|
78
|
+
|
79
|
+
</ul>
|
80
|
+
<a href="#" class="inheritanceTree">show all</a>
|
81
|
+
|
82
|
+
</dd>
|
83
|
+
</dl>
|
84
|
+
|
85
|
+
|
86
|
+
|
87
|
+
|
88
|
+
|
89
|
+
|
90
|
+
|
91
|
+
|
92
|
+
|
93
|
+
|
94
|
+
|
95
|
+
<dl>
|
96
|
+
<dt>Defined in:</dt>
|
97
|
+
<dd>lib/mocha/expectation_error_factory.rb</dd>
|
98
|
+
</dl>
|
99
|
+
|
100
|
+
</div>
|
101
|
+
|
102
|
+
<h2>Overview</h2><div class="docstring">
|
103
|
+
<div class="discussion">
|
104
|
+
|
105
|
+
<p>This factory determines what class of exception should be raised when Mocha
|
106
|
+
detects a test failure.</p>
|
107
|
+
|
108
|
+
<p>This class should only be used by authors of test libraries and not by
|
109
|
+
typical “users” of Mocha.</p>
|
110
|
+
|
111
|
+
<p>For example, it is used by
|
112
|
+
<code>Mocha::Integration::MiniTest::Adapter</code> in order to have Mocha
|
113
|
+
raise a <code>MiniTest::Assertion</code> which can then be sensibly handled
|
114
|
+
by <code>MiniTest::Unit::TestCase</code>.</p>
|
115
|
+
|
116
|
+
|
117
|
+
</div>
|
118
|
+
</div>
|
119
|
+
<div class="tags">
|
120
|
+
|
121
|
+
|
122
|
+
<p class="tag_title">See Also:</p>
|
123
|
+
<ul class="see">
|
124
|
+
|
125
|
+
<li><span class='object_link'><a href="Integration/MiniTest/Adapter.html" title="Mocha::Integration::MiniTest::Adapter (module)">Integration::MiniTest::Adapter</a></span></li>
|
126
|
+
|
127
|
+
</ul>
|
128
|
+
|
129
|
+
</div>
|
130
|
+
|
131
|
+
|
132
|
+
|
133
|
+
<h2>Class Attribute Summary <small><a href="#" class="summary_toggle">collapse</a></small></h2>
|
134
|
+
<ul class="summary">
|
135
|
+
|
136
|
+
<li class="public ">
|
137
|
+
<span class="summary_signature">
|
138
|
+
|
139
|
+
<a href="#exception_class-class_method" title="exception_class (class method)">.<strong>exception_class</strong> ⇒ Exception </a>
|
140
|
+
|
141
|
+
|
142
|
+
|
143
|
+
</span>
|
144
|
+
|
145
|
+
|
146
|
+
|
147
|
+
|
148
|
+
|
149
|
+
|
150
|
+
|
151
|
+
|
152
|
+
|
153
|
+
|
154
|
+
|
155
|
+
|
156
|
+
<span class="summary_desc"><div class='inline'>
|
157
|
+
<p>Determines what class of exception should be raised when Mocha detects a
|
158
|
+
test failure.</p>
|
159
|
+
</div></span>
|
160
|
+
|
161
|
+
</li>
|
162
|
+
|
163
|
+
|
164
|
+
</ul>
|
165
|
+
|
166
|
+
|
167
|
+
|
168
|
+
|
169
|
+
|
170
|
+
<div id="class_attr_details" class="attr_details">
|
171
|
+
<h2>Class Attribute Details</h2>
|
172
|
+
|
173
|
+
|
174
|
+
<span id="exception_class=-class_method"></span>
|
175
|
+
<div class="method_details first">
|
176
|
+
<h3 class="signature first" id="exception_class-class_method">
|
177
|
+
|
178
|
+
.<strong>exception_class</strong> ⇒ <tt>Exception</tt>
|
179
|
+
|
180
|
+
|
181
|
+
|
182
|
+
|
183
|
+
|
184
|
+
</h3><div class="docstring">
|
185
|
+
<div class="discussion">
|
186
|
+
|
187
|
+
<p>Determines what class of exception should be raised when Mocha detects a
|
188
|
+
test failure.</p>
|
189
|
+
|
190
|
+
<p>This attribute may be set by authors of test libraries in order to have
|
191
|
+
Mocha raise exceptions of a specific class when there is an unexpected
|
192
|
+
invocation or an unsatisfied expectation.</p>
|
193
|
+
|
194
|
+
<p>By default a <code>Mocha::ExpectationError</code> will be raised.</p>
|
195
|
+
|
196
|
+
|
197
|
+
</div>
|
198
|
+
</div>
|
199
|
+
<div class="tags">
|
200
|
+
|
201
|
+
<p class="tag_title">Returns:</p>
|
202
|
+
<ul class="return">
|
203
|
+
|
204
|
+
<li>
|
205
|
+
|
206
|
+
|
207
|
+
<span class='type'>(<tt>Exception</tt>)</span>
|
208
|
+
|
209
|
+
|
210
|
+
|
211
|
+
—
|
212
|
+
<div class='inline'>
|
213
|
+
<p>class of exception to be raised when an expectation error occurs</p>
|
214
|
+
</div>
|
215
|
+
|
216
|
+
</li>
|
217
|
+
|
218
|
+
</ul>
|
219
|
+
|
220
|
+
<p class="tag_title">See Also:</p>
|
221
|
+
<ul class="see">
|
222
|
+
|
223
|
+
<li><span class='object_link'><a href="ExpectationError.html" title="Mocha::ExpectationError (class)">Mocha::ExpectationError</a></span></li>
|
224
|
+
|
225
|
+
</ul>
|
226
|
+
|
227
|
+
</div><table class="source_code">
|
228
|
+
<tr>
|
229
|
+
<td>
|
230
|
+
<pre class="lines">
|
231
|
+
|
232
|
+
|
233
|
+
23
|
234
|
+
24
|
235
|
+
25</pre>
|
236
|
+
</td>
|
237
|
+
<td>
|
238
|
+
<pre class="code"><span class="info file"># File 'lib/mocha/expectation_error_factory.rb', line 23</span>
|
239
|
+
|
240
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_exception_class'>exception_class</span>
|
241
|
+
<span class='ivar'>@exception_class</span>
|
242
|
+
<span class='kw'>end</span></pre>
|
243
|
+
</td>
|
244
|
+
</tr>
|
245
|
+
</table>
|
246
|
+
</div>
|
247
|
+
|
248
|
+
</div>
|
249
|
+
|
250
|
+
|
251
|
+
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-625523-7"></script>
|
252
|
+
<script>
|
253
|
+
window.dataLayer = window.dataLayer || [];
|
254
|
+
function gtag(){dataLayer.push(arguments);}
|
255
|
+
gtag('js', new Date());
|
256
|
+
|
257
|
+
gtag('config', 'UA-625523-7');
|
258
|
+
</script>
|
259
|
+
</div>
|
260
|
+
|
261
|
+
<div id="footer">
|
262
|
+
Generated on Tue Jan 15 17:13:06 2019 by
|
263
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
264
|
+
0.9.16 (ruby-2.5.3).
|
265
|
+
</div>
|
266
|
+
|
267
|
+
</div>
|
268
|
+
</body>
|
269
|
+
</html>
|
@@ -0,0 +1,385 @@
|
|
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::Hooks
|
8
|
+
|
9
|
+
— Mocha 1.8.0
|
10
|
+
|
11
|
+
</title>
|
12
|
+
|
13
|
+
<link rel="stylesheet" href="../css/style.css" type="text/css" charset="utf-8" />
|
14
|
+
|
15
|
+
<link rel="stylesheet" href="../css/common.css" type="text/css" charset="utf-8" />
|
16
|
+
|
17
|
+
<script type="text/javascript" charset="utf-8">
|
18
|
+
pathId = "Mocha::Hooks";
|
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 (H)</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">Hooks</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::Hooks
|
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/hooks.rb</dd>
|
87
|
+
</dl>
|
88
|
+
|
89
|
+
</div>
|
90
|
+
|
91
|
+
<h2>Overview</h2><div class="docstring">
|
92
|
+
<div class="discussion">
|
93
|
+
|
94
|
+
<p>Integration hooks for test library authors.</p>
|
95
|
+
|
96
|
+
<p>The methods in this module should be called from test libraries wishing to
|
97
|
+
integrate with Mocha.</p>
|
98
|
+
|
99
|
+
<p>This module is provided as part of the <code>Mocha::API</code> module and
|
100
|
+
is therefore part of the public API, but should only be used by authors of
|
101
|
+
test libraries and not by typical “users” of Mocha.</p>
|
102
|
+
|
103
|
+
<p>Integration with Test::Unit and MiniTest are provided as part of Mocha,
|
104
|
+
because they are (or were once) part of the Ruby standard library.
|
105
|
+
Integration with other test libraries is not provided as
|
106
|
+
<strong>part</strong> of Mocha, but is supported by means of the methods in
|
107
|
+
this module.</p>
|
108
|
+
|
109
|
+
<p>See the code in the <code>Adapter</code> modules for examples of how to use
|
110
|
+
the methods in this module. <code>Mocha::ExpectationErrorFactory</code> may
|
111
|
+
be used if you want <code>Mocha</code> to raise a different type of
|
112
|
+
exception.</p>
|
113
|
+
|
114
|
+
|
115
|
+
</div>
|
116
|
+
</div>
|
117
|
+
<div class="tags">
|
118
|
+
|
119
|
+
|
120
|
+
<p class="tag_title">See Also:</p>
|
121
|
+
<ul class="see">
|
122
|
+
|
123
|
+
<li><span class='object_link'><a href="Integration/TestUnit/Adapter.html" title="Mocha::Integration::TestUnit::Adapter (module)">Integration::TestUnit::Adapter</a></span></li>
|
124
|
+
|
125
|
+
<li><span class='object_link'><a href="Integration/MiniTest/Adapter.html" title="Mocha::Integration::MiniTest::Adapter (module)">Integration::MiniTest::Adapter</a></span></li>
|
126
|
+
|
127
|
+
<li><span class='object_link'><a href="ExpectationErrorFactory.html" title="Mocha::ExpectationErrorFactory (class)">ExpectationErrorFactory</a></span></li>
|
128
|
+
|
129
|
+
<li><span class='object_link'><a href="API.html" title="Mocha::API (module)">API</a></span></li>
|
130
|
+
|
131
|
+
</ul>
|
132
|
+
|
133
|
+
</div>
|
134
|
+
|
135
|
+
|
136
|
+
|
137
|
+
|
138
|
+
|
139
|
+
|
140
|
+
|
141
|
+
<h2>
|
142
|
+
Instance Method Summary
|
143
|
+
<small><a href="#" class="summary_toggle">collapse</a></small>
|
144
|
+
</h2>
|
145
|
+
|
146
|
+
<ul class="summary">
|
147
|
+
|
148
|
+
<li class="public ">
|
149
|
+
<span class="summary_signature">
|
150
|
+
|
151
|
+
<a href="#mocha_setup-instance_method" title="#mocha_setup (instance method)">#<strong>mocha_setup</strong> ⇒ Object </a>
|
152
|
+
|
153
|
+
|
154
|
+
|
155
|
+
</span>
|
156
|
+
|
157
|
+
|
158
|
+
|
159
|
+
|
160
|
+
|
161
|
+
|
162
|
+
|
163
|
+
|
164
|
+
|
165
|
+
<span class="summary_desc"><div class='inline'>
|
166
|
+
<p>Prepares Mocha before a test (only for use by authors of test libraries).</p>
|
167
|
+
</div></span>
|
168
|
+
|
169
|
+
</li>
|
170
|
+
|
171
|
+
|
172
|
+
<li class="public ">
|
173
|
+
<span class="summary_signature">
|
174
|
+
|
175
|
+
<a href="#mocha_teardown-instance_method" title="#mocha_teardown (instance method)">#<strong>mocha_teardown</strong> ⇒ Object </a>
|
176
|
+
|
177
|
+
|
178
|
+
|
179
|
+
</span>
|
180
|
+
|
181
|
+
|
182
|
+
|
183
|
+
|
184
|
+
|
185
|
+
|
186
|
+
|
187
|
+
|
188
|
+
|
189
|
+
<span class="summary_desc"><div class='inline'>
|
190
|
+
<p>Resets Mocha after a test (only for use by authors of test libraries).</p>
|
191
|
+
</div></span>
|
192
|
+
|
193
|
+
</li>
|
194
|
+
|
195
|
+
|
196
|
+
<li class="public ">
|
197
|
+
<span class="summary_signature">
|
198
|
+
|
199
|
+
<a href="#mocha_verify-instance_method" title="#mocha_verify (instance method)">#<strong>mocha_verify</strong>(assertion_counter = nil) ⇒ Object </a>
|
200
|
+
|
201
|
+
|
202
|
+
|
203
|
+
</span>
|
204
|
+
|
205
|
+
|
206
|
+
|
207
|
+
|
208
|
+
|
209
|
+
|
210
|
+
|
211
|
+
|
212
|
+
|
213
|
+
<span class="summary_desc"><div class='inline'>
|
214
|
+
<p>Verifies that all mock expectations have been met (only for use by authors
|
215
|
+
of test libraries).</p>
|
216
|
+
</div></span>
|
217
|
+
|
218
|
+
</li>
|
219
|
+
|
220
|
+
|
221
|
+
</ul>
|
222
|
+
|
223
|
+
|
224
|
+
|
225
|
+
|
226
|
+
<div id="instance_method_details" class="method_details_list">
|
227
|
+
<h2>Instance Method Details</h2>
|
228
|
+
|
229
|
+
|
230
|
+
<div class="method_details first">
|
231
|
+
<h3 class="signature first" id="mocha_setup-instance_method">
|
232
|
+
|
233
|
+
#<strong>mocha_setup</strong> ⇒ <tt><span class='object_link'>Object</span></tt>
|
234
|
+
|
235
|
+
|
236
|
+
|
237
|
+
|
238
|
+
|
239
|
+
</h3><div class="docstring">
|
240
|
+
<div class="discussion">
|
241
|
+
|
242
|
+
<p>Prepares Mocha before a test (only for use by authors of test libraries).</p>
|
243
|
+
|
244
|
+
<p>This method should be called before each individual test starts (including
|
245
|
+
before any “setup” code).</p>
|
246
|
+
|
247
|
+
|
248
|
+
</div>
|
249
|
+
</div>
|
250
|
+
<div class="tags">
|
251
|
+
|
252
|
+
|
253
|
+
</div><table class="source_code">
|
254
|
+
<tr>
|
255
|
+
<td>
|
256
|
+
<pre class="lines">
|
257
|
+
|
258
|
+
|
259
|
+
22
|
260
|
+
23
|
261
|
+
24</pre>
|
262
|
+
</td>
|
263
|
+
<td>
|
264
|
+
<pre class="code"><span class="info file"># File 'lib/mocha/hooks.rb', line 22</span>
|
265
|
+
|
266
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_mocha_setup'>mocha_setup</span>
|
267
|
+
<span class='const'>Mockery</span><span class='period'>.</span><span class='id identifier rubyid_setup'>setup</span>
|
268
|
+
<span class='kw'>end</span></pre>
|
269
|
+
</td>
|
270
|
+
</tr>
|
271
|
+
</table>
|
272
|
+
</div>
|
273
|
+
|
274
|
+
<div class="method_details ">
|
275
|
+
<h3 class="signature " id="mocha_teardown-instance_method">
|
276
|
+
|
277
|
+
#<strong>mocha_teardown</strong> ⇒ <tt><span class='object_link'>Object</span></tt>
|
278
|
+
|
279
|
+
|
280
|
+
|
281
|
+
|
282
|
+
|
283
|
+
</h3><div class="docstring">
|
284
|
+
<div class="discussion">
|
285
|
+
|
286
|
+
<p>Resets Mocha after a test (only for use by authors of test libraries).</p>
|
287
|
+
|
288
|
+
<p>This method should be called after each individual test has finished
|
289
|
+
(including after any “teardown” code).</p>
|
290
|
+
|
291
|
+
|
292
|
+
</div>
|
293
|
+
</div>
|
294
|
+
<div class="tags">
|
295
|
+
|
296
|
+
|
297
|
+
</div><table class="source_code">
|
298
|
+
<tr>
|
299
|
+
<td>
|
300
|
+
<pre class="lines">
|
301
|
+
|
302
|
+
|
303
|
+
38
|
304
|
+
39
|
305
|
+
40</pre>
|
306
|
+
</td>
|
307
|
+
<td>
|
308
|
+
<pre class="code"><span class="info file"># File 'lib/mocha/hooks.rb', line 38</span>
|
309
|
+
|
310
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_mocha_teardown'>mocha_teardown</span>
|
311
|
+
<span class='const'>Mockery</span><span class='period'>.</span><span class='id identifier rubyid_teardown'>teardown</span>
|
312
|
+
<span class='kw'>end</span></pre>
|
313
|
+
</td>
|
314
|
+
</tr>
|
315
|
+
</table>
|
316
|
+
</div>
|
317
|
+
|
318
|
+
<div class="method_details ">
|
319
|
+
<h3 class="signature " id="mocha_verify-instance_method">
|
320
|
+
|
321
|
+
#<strong>mocha_verify</strong>(assertion_counter = nil) ⇒ <tt><span class='object_link'>Object</span></tt>
|
322
|
+
|
323
|
+
|
324
|
+
|
325
|
+
|
326
|
+
|
327
|
+
</h3><div class="docstring">
|
328
|
+
<div class="discussion">
|
329
|
+
|
330
|
+
<p>Verifies that all mock expectations have been met (only for use by authors
|
331
|
+
of test libraries).</p>
|
332
|
+
|
333
|
+
<p>This is equivalent to a series of “assertions”.</p>
|
334
|
+
|
335
|
+
<p>This method should be called at the end of each individual test, before it
|
336
|
+
has been determined whether or not the test has passed.</p>
|
337
|
+
|
338
|
+
|
339
|
+
</div>
|
340
|
+
</div>
|
341
|
+
<div class="tags">
|
342
|
+
|
343
|
+
|
344
|
+
</div><table class="source_code">
|
345
|
+
<tr>
|
346
|
+
<td>
|
347
|
+
<pre class="lines">
|
348
|
+
|
349
|
+
|
350
|
+
31
|
351
|
+
32
|
352
|
+
33</pre>
|
353
|
+
</td>
|
354
|
+
<td>
|
355
|
+
<pre class="code"><span class="info file"># File 'lib/mocha/hooks.rb', line 31</span>
|
356
|
+
|
357
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_mocha_verify'>mocha_verify</span><span class='lparen'>(</span><span class='id identifier rubyid_assertion_counter'>assertion_counter</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
|
358
|
+
<span class='const'>Mockery</span><span class='period'>.</span><span class='id identifier rubyid_verify'>verify</span><span class='lparen'>(</span><span class='id identifier rubyid_assertion_counter'>assertion_counter</span><span class='rparen'>)</span>
|
359
|
+
<span class='kw'>end</span></pre>
|
360
|
+
</td>
|
361
|
+
</tr>
|
362
|
+
</table>
|
363
|
+
</div>
|
364
|
+
|
365
|
+
</div>
|
366
|
+
|
367
|
+
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-625523-7"></script>
|
368
|
+
<script>
|
369
|
+
window.dataLayer = window.dataLayer || [];
|
370
|
+
function gtag(){dataLayer.push(arguments);}
|
371
|
+
gtag('js', new Date());
|
372
|
+
|
373
|
+
gtag('config', 'UA-625523-7');
|
374
|
+
</script>
|
375
|
+
</div>
|
376
|
+
|
377
|
+
<div id="footer">
|
378
|
+
Generated on Tue Jan 15 17:13:05 2019 by
|
379
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
380
|
+
0.9.16 (ruby-2.5.3).
|
381
|
+
</div>
|
382
|
+
|
383
|
+
</div>
|
384
|
+
</body>
|
385
|
+
</html>
|