sprout 1.1.11.pre → 1.1.13.pre
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of sprout might be problematic. Click here for more details.
- data/Gemfile.lock +3 -4
- data/VERSION +1 -1
- data/doc/Dir.html +288 -0
- data/doc/Rake/Task.html +184 -0
- data/doc/Sprout.html +740 -0
- data/doc/Sprout/ArchiveUnpacker.html +1246 -0
- data/doc/Sprout/CommandLine.html +520 -0
- data/doc/Sprout/Concern.html +351 -0
- data/doc/Sprout/Errors.html +101 -0
- data/doc/Sprout/Errors/ArchiveUnpackerError.html +125 -0
- data/doc/Sprout/Errors/DestinationExistsError.html +133 -0
- data/doc/Sprout/Errors/DuplicateMemberError.html +132 -0
- data/doc/Sprout/Errors/ExecutableError.html +125 -0
- data/doc/Sprout/Errors/ExecutableRegistrationError.html +132 -0
- data/doc/Sprout/Errors/ExecutionError.html +121 -0
- data/doc/Sprout/Errors/GeneratorError.html +125 -0
- data/doc/Sprout/Errors/InvalidArgumentError.html +132 -0
- data/doc/Sprout/Errors/LoadError.html +121 -0
- data/doc/Sprout/Errors/MissingArgumentError.html +132 -0
- data/doc/Sprout/Errors/MissingExecutableError.html +132 -0
- data/doc/Sprout/Errors/MissingGeneratorError.html +132 -0
- data/doc/Sprout/Errors/MissingTemplateError.html +132 -0
- data/doc/Sprout/Errors/ProcessRunnerError.html +121 -0
- data/doc/Sprout/Errors/RemoteFileLoaderError.html +110 -0
- data/doc/Sprout/Errors/SproutError.html +114 -0
- data/doc/Sprout/Errors/UnknownArchiveType.html +122 -0
- data/doc/Sprout/Errors/UsageError.html +121 -0
- data/doc/Sprout/Errors/ValidationError.html +121 -0
- data/doc/Sprout/Errors/VersionRequirementNotMetError.html +121 -0
- data/doc/Sprout/Executable.html +169 -0
- data/doc/Sprout/Executable/Base.html +2813 -0
- data/doc/Sprout/Executable/Boolean.html +534 -0
- data/doc/Sprout/Executable/CollectionParam.html +483 -0
- data/doc/Sprout/Executable/FileParam.html +484 -0
- data/doc/Sprout/Executable/Files.html +292 -0
- data/doc/Sprout/Executable/Number.html +141 -0
- data/doc/Sprout/Executable/Param.html +2874 -0
- data/doc/Sprout/Executable/ParameterFactory.html +232 -0
- data/doc/Sprout/Executable/Path.html +223 -0
- data/doc/Sprout/Executable/Paths.html +253 -0
- data/doc/Sprout/Executable/Session.html +1513 -0
- data/doc/Sprout/Executable/StringParam.html +213 -0
- data/doc/Sprout/Executable/Strings.html +167 -0
- data/doc/Sprout/Executable/Url.html +160 -0
- data/doc/Sprout/Executable/Urls.html +170 -0
- data/doc/Sprout/FileTarget.html +1109 -0
- data/doc/Sprout/Generator.html +750 -0
- data/doc/Sprout/Generator/Base.html +1902 -0
- data/doc/Sprout/Generator/Command.html +690 -0
- data/doc/Sprout/Generator/DirectoryManifest.html +476 -0
- data/doc/Sprout/Generator/FileManifest.html +643 -0
- data/doc/Sprout/Generator/Manifest.html +377 -0
- data/doc/Sprout/Generator/TemplateManifest.html +194 -0
- data/doc/Sprout/GeneratorGenerator.html +1115 -0
- data/doc/Sprout/Library.html +1146 -0
- data/doc/Sprout/LibraryGenerator.html +331 -0
- data/doc/Sprout/OutputBuffer.html +445 -0
- data/doc/Sprout/Platform.html +714 -0
- data/doc/Sprout/ProcessRunner.html +1707 -0
- data/doc/Sprout/ProgressBar.html +366 -0
- data/doc/Sprout/ProgressBarImpl.html +2109 -0
- data/doc/Sprout/ProgressBarManager.html +424 -0
- data/doc/Sprout/ProgressBarOutputStream.html +406 -0
- data/doc/Sprout/RDocParser.html +211 -0
- data/doc/Sprout/RemoteFileLoader.html +172 -0
- data/doc/Sprout/RemoteFileTarget.html +679 -0
- data/doc/Sprout/ReversedProgressBar.html +184 -0
- data/doc/Sprout/RubyFeature.html +155 -0
- data/doc/Sprout/RubyFeature/ClassMethods.html +1065 -0
- data/doc/Sprout/RubyGenerator.html +786 -0
- data/doc/Sprout/Specification.html +767 -0
- data/doc/Sprout/System.html +191 -0
- data/doc/Sprout/System/BaseSystem.html +1660 -0
- data/doc/Sprout/System/JavaSystem.html +122 -0
- data/doc/Sprout/System/OSXSystem.html +335 -0
- data/doc/Sprout/System/ThreadMock.html +183 -0
- data/doc/Sprout/System/UnixSystem.html +584 -0
- data/doc/Sprout/System/VistaSystem.html +251 -0
- data/doc/Sprout/System/WinNixSystem.html +325 -0
- data/doc/Sprout/System/WinSystem.html +571 -0
- data/doc/Sprout/TestHelper.html +2165 -0
- data/doc/Sprout/ToolGenerator.html +953 -0
- data/doc/Sprout/VERSION.html +118 -0
- data/doc/String.html +290 -0
- data/doc/_index.html +820 -0
- data/doc/class_list.html +36 -0
- data/doc/css/common.css +1 -0
- data/doc/css/full_list.css +53 -0
- data/doc/css/style.css +310 -0
- data/doc/file.README.html +96 -0
- data/doc/file_list.html +41 -0
- data/doc/frames.html +13 -0
- data/doc/index.html +96 -0
- data/doc/js/app.js +202 -0
- data/doc/js/full_list.js +149 -0
- data/doc/js/jquery.js +154 -0
- data/doc/method_list.html +3603 -0
- data/doc/top-level-namespace.html +192 -0
- data/lib/sprout.rb +1 -0
- data/lib/sprout/executable/base.rb +2 -5
- data/lib/sprout/executable/param.rb +15 -8
- data/lib/sprout/executable/session.rb +1 -1
- data/lib/sprout/library.rb +44 -2
- data/test/unit/executable_test.rb +3 -5
- metadata +99 -3
@@ -0,0 +1,2165 @@
|
|
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 name="Content-Type" content="text/html; charset=utf-8" />
|
6
|
+
<title>Module: Sprout::TestHelper</title>
|
7
|
+
<link rel="stylesheet" href="../css/style.css" type="text/css" media="screen" charset="utf-8" />
|
8
|
+
<link rel="stylesheet" href="../css/common.css" type="text/css" media="screen" charset="utf-8" />
|
9
|
+
|
10
|
+
<script type="text/javascript" charset="utf-8">
|
11
|
+
relpath = '..';
|
12
|
+
if (relpath != '') relpath += '/';
|
13
|
+
</script>
|
14
|
+
<script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
|
15
|
+
<script type="text/javascript" charset="utf-8" src="../js/app.js"></script>
|
16
|
+
|
17
|
+
</head>
|
18
|
+
<body>
|
19
|
+
<script type="text/javascript" charset="utf-8">
|
20
|
+
if (window.top.frames.main) document.body.className = 'frames';
|
21
|
+
</script>
|
22
|
+
|
23
|
+
<div id="header">
|
24
|
+
<div id="menu">
|
25
|
+
|
26
|
+
<a href="../_index.html">Index (T)</a> »
|
27
|
+
<span class='title'><span class='object_link'><a href="../Sprout.html" title="Sprout (module)">Sprout</a></span></span>
|
28
|
+
»
|
29
|
+
<span class="title">TestHelper</span>
|
30
|
+
|
31
|
+
|
32
|
+
<div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
|
33
|
+
</div>
|
34
|
+
|
35
|
+
<div id="search">
|
36
|
+
<a id="class_list_link" href="#">Class List</a>
|
37
|
+
<a id="method_list_link" href="#">Method List</a>
|
38
|
+
<a id ="file_list_link" href="#">File List</a>
|
39
|
+
</div>
|
40
|
+
|
41
|
+
<div class="clear"></div>
|
42
|
+
</div>
|
43
|
+
|
44
|
+
<iframe id="search_frame"></iframe>
|
45
|
+
|
46
|
+
<div id="content"><h1>Module: Sprout::TestHelper
|
47
|
+
|
48
|
+
|
49
|
+
|
50
|
+
</h1>
|
51
|
+
|
52
|
+
<dl class="box">
|
53
|
+
|
54
|
+
|
55
|
+
|
56
|
+
|
57
|
+
|
58
|
+
<dt class="r1">Includes:</dt>
|
59
|
+
<dd class="r1">Gem::DefaultUserInteraction</dd>
|
60
|
+
|
61
|
+
|
62
|
+
|
63
|
+
|
64
|
+
|
65
|
+
<dt class="r2 last">Defined in:</dt>
|
66
|
+
<dd class="r2 last">lib/sprout/test_helper.rb</dd>
|
67
|
+
|
68
|
+
</dl>
|
69
|
+
<div class="clear"></div>
|
70
|
+
|
71
|
+
<h2>Overview</h2><div class="docstring">
|
72
|
+
<div class="discussion">
|
73
|
+
|
74
|
+
<p>A collection of custom assertions and helper methods to take some of the
|
75
|
+
suck out of testing functionality that is based on Sprout features.</p>
|
76
|
+
|
77
|
+
<p>Include this module into your test cases to make testing Sprout tools
|
78
|
+
easier.</p>
|
79
|
+
|
80
|
+
<pre class="code"><span class='id require'>require</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>sprout/test/sprout_test_helper</span><span class='tstring_end'>'</span></span>
|
81
|
+
|
82
|
+
<span class='kw'>class</span> <span class='const'>SomeTestCase</span> <span class='op'><</span> <span class='const'>Test</span><span class='op'>::</span><span class='const'>Unit</span><span class='op'>::</span><span class='const'>TestCase</span>
|
83
|
+
<span class='id include'>include</span> <span class='const'>Sprout</span><span class='op'>::</span><span class='const'>TestHelper</span>
|
84
|
+
|
85
|
+
<span class='kw'>def</span> <span class='id setup'>setup</span>
|
86
|
+
<span class='kw'>super</span>
|
87
|
+
<span class='comment'># do something
|
88
|
+
</span> <span class='kw'>end</span>
|
89
|
+
|
90
|
+
<span class='kw'>def</span> <span class='id teardown'>teardown</span>
|
91
|
+
<span class='kw'>super</span>
|
92
|
+
<span class='comment'># do something
|
93
|
+
</span> <span class='kw'>end</span>
|
94
|
+
|
95
|
+
<span class='kw'>def</span> <span class='id test_something'>test_something</span>
|
96
|
+
<span class='id assert_file'>assert_file</span> <span class='const'>File</span><span class='period'>.</span><span class='id join'>join</span><span class='lparen'>(</span><span class='id fixtures'>fixtures</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>some_file</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id f'>f</span><span class='op'>|</span>
|
97
|
+
<span class='id assert_matches'>assert_matches</span> <span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>Fred</span><span class='regexp_end'>/</span></span><span class='comma'>,</span> <span class='id f'>f</span>
|
98
|
+
<span class='kw'>end</span>
|
99
|
+
<span class='kw'>end</span>
|
100
|
+
<span class='kw'>end</span></pre>
|
101
|
+
|
102
|
+
|
103
|
+
</div>
|
104
|
+
</div>
|
105
|
+
<div class="tags">
|
106
|
+
|
107
|
+
</div>
|
108
|
+
<h2>Constant Summary</h2>
|
109
|
+
|
110
|
+
<dl class="constants">
|
111
|
+
|
112
|
+
<dt id="FIXTURES_NAME-constant" class="">FIXTURES_NAME =
|
113
|
+
<div class="docstring">
|
114
|
+
<div class="discussion">
|
115
|
+
|
116
|
+
<p>The name of the folder that should contain fixture data.</p>
|
117
|
+
|
118
|
+
|
119
|
+
</div>
|
120
|
+
</div>
|
121
|
+
<div class="tags">
|
122
|
+
|
123
|
+
</div>
|
124
|
+
</dt>
|
125
|
+
<dd><pre class="code"><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>fixtures</span><span class='tstring_end'>'</span></span></pre></dd>
|
126
|
+
|
127
|
+
</dl>
|
128
|
+
|
129
|
+
|
130
|
+
|
131
|
+
|
132
|
+
|
133
|
+
|
134
|
+
<h2>
|
135
|
+
Instance Method Summary
|
136
|
+
<small>(<a href="#" class="summary_toggle">collapse</a>)</small>
|
137
|
+
</h2>
|
138
|
+
|
139
|
+
<ul class="summary">
|
140
|
+
|
141
|
+
<li class="protected ">
|
142
|
+
<span class="summary_signature">
|
143
|
+
|
144
|
+
<a href="#as_a_mac_system-instance_method" title="#as_a_mac_system (instance method)">- (Sprout::System::OSXSystem) <strong>as_a_mac_system</strong> {|Sprout::System::OSXSystem| ... }</a>
|
145
|
+
|
146
|
+
|
147
|
+
|
148
|
+
</span>
|
149
|
+
|
150
|
+
|
151
|
+
<span class="note title protected">protected</span>
|
152
|
+
|
153
|
+
|
154
|
+
|
155
|
+
|
156
|
+
|
157
|
+
<span class="summary_desc"><div class='inline'>
|
158
|
+
<p>Execute a block as a OSXSystem.</p>
|
159
|
+
</div></span>
|
160
|
+
|
161
|
+
</li>
|
162
|
+
|
163
|
+
|
164
|
+
<li class="protected ">
|
165
|
+
<span class="summary_signature">
|
166
|
+
|
167
|
+
<a href="#as_a_unix_system-instance_method" title="#as_a_unix_system (instance method)">- (Sprout::System::UnixSystem) <strong>as_a_unix_system</strong> {|Sprout::System::UnixSystem| ... }</a>
|
168
|
+
|
169
|
+
|
170
|
+
|
171
|
+
</span>
|
172
|
+
|
173
|
+
|
174
|
+
<span class="note title protected">protected</span>
|
175
|
+
|
176
|
+
|
177
|
+
|
178
|
+
|
179
|
+
|
180
|
+
<span class="summary_desc"><div class='inline'>
|
181
|
+
<p>Execute a block as a UnixSystem.</p>
|
182
|
+
</div></span>
|
183
|
+
|
184
|
+
</li>
|
185
|
+
|
186
|
+
|
187
|
+
<li class="protected ">
|
188
|
+
<span class="summary_signature">
|
189
|
+
|
190
|
+
<a href="#as_a_win_nix_system-instance_method" title="#as_a_win_nix_system (instance method)">- (Sprout::System::WinNixSystem) <strong>as_a_win_nix_system</strong> {|Sprout::System::WinNixSystem| ... }</a>
|
191
|
+
|
192
|
+
|
193
|
+
|
194
|
+
</span>
|
195
|
+
|
196
|
+
|
197
|
+
<span class="note title protected">protected</span>
|
198
|
+
|
199
|
+
|
200
|
+
|
201
|
+
|
202
|
+
|
203
|
+
<span class="summary_desc"><div class='inline'>
|
204
|
+
<p>Execute a block as a WinNixSystem.</p>
|
205
|
+
</div></span>
|
206
|
+
|
207
|
+
</li>
|
208
|
+
|
209
|
+
|
210
|
+
<li class="protected ">
|
211
|
+
<span class="summary_signature">
|
212
|
+
|
213
|
+
<a href="#as_a_windows_system-instance_method" title="#as_a_windows_system (instance method)">- (Sprout::System::WinSystem) <strong>as_a_windows_system</strong> {|Sprout::System::WinSystem| ... }</a>
|
214
|
+
|
215
|
+
|
216
|
+
|
217
|
+
</span>
|
218
|
+
|
219
|
+
|
220
|
+
<span class="note title protected">protected</span>
|
221
|
+
|
222
|
+
|
223
|
+
|
224
|
+
|
225
|
+
|
226
|
+
<span class="summary_desc"><div class='inline'>
|
227
|
+
<p>Execute a block as a WinSystem.</p>
|
228
|
+
</div></span>
|
229
|
+
|
230
|
+
</li>
|
231
|
+
|
232
|
+
|
233
|
+
<li class="protected ">
|
234
|
+
<span class="summary_signature">
|
235
|
+
|
236
|
+
<a href="#as_each_system-instance_method" title="#as_each_system (instance method)">- (Sprout::System::BaseSystem) <strong>as_each_system</strong> {|Sprout::System::BaseSystem| ... }</a>
|
237
|
+
|
238
|
+
|
239
|
+
|
240
|
+
</span>
|
241
|
+
|
242
|
+
|
243
|
+
<span class="note title protected">protected</span>
|
244
|
+
|
245
|
+
|
246
|
+
|
247
|
+
|
248
|
+
|
249
|
+
<span class="summary_desc"><div class='inline'>
|
250
|
+
<p>Execute a block as each available Sprout::System, any code within this
|
251
|
+
block that calls Sprout.current_user will receive the currently active
|
252
|
+
Sprout::System.</p>
|
253
|
+
</div></span>
|
254
|
+
|
255
|
+
</li>
|
256
|
+
|
257
|
+
|
258
|
+
<li class="protected ">
|
259
|
+
<span class="summary_signature">
|
260
|
+
|
261
|
+
<a href="#assert_directory-instance_method" title="#assert_directory (instance method)">- (Object) <strong>assert_directory</strong>(path, message = nil) </a>
|
262
|
+
|
263
|
+
|
264
|
+
|
265
|
+
</span>
|
266
|
+
|
267
|
+
|
268
|
+
<span class="note title protected">protected</span>
|
269
|
+
|
270
|
+
|
271
|
+
|
272
|
+
|
273
|
+
|
274
|
+
<span class="summary_desc"><div class='inline'>
|
275
|
+
<p>Assert that a directory exists at <tt>path</tt> and display
|
276
|
+
<tt>message</tt> if it does not.</p>
|
277
|
+
</div></span>
|
278
|
+
|
279
|
+
</li>
|
280
|
+
|
281
|
+
|
282
|
+
<li class="protected ">
|
283
|
+
<span class="summary_signature">
|
284
|
+
|
285
|
+
<a href="#assert_file-instance_method" title="#assert_file (instance method)">- (Object) <strong>assert_file</strong>(path, message = nil) {|String| ... }</a>
|
286
|
+
|
287
|
+
|
288
|
+
|
289
|
+
</span>
|
290
|
+
|
291
|
+
|
292
|
+
<span class="note title protected">protected</span>
|
293
|
+
|
294
|
+
|
295
|
+
|
296
|
+
|
297
|
+
|
298
|
+
<span class="summary_desc"><div class='inline'>
|
299
|
+
<p>Assert that a file exists at <tt>path</tt> and display <tt>message</tt> if
|
300
|
+
it does not.</p>
|
301
|
+
</div></span>
|
302
|
+
|
303
|
+
</li>
|
304
|
+
|
305
|
+
|
306
|
+
<li class="protected ">
|
307
|
+
<span class="summary_signature">
|
308
|
+
|
309
|
+
<a href="#assert_matches-instance_method" title="#assert_matches (instance method)">- (Object) <strong>assert_matches</strong>(expression, string, message = '') </a>
|
310
|
+
|
311
|
+
|
312
|
+
|
313
|
+
</span>
|
314
|
+
|
315
|
+
|
316
|
+
<span class="note title protected">protected</span>
|
317
|
+
|
318
|
+
|
319
|
+
|
320
|
+
|
321
|
+
|
322
|
+
<span class="summary_desc"><div class='inline'>
|
323
|
+
<p>Assert that an expression matches the provided string.</p>
|
324
|
+
</div></span>
|
325
|
+
|
326
|
+
</li>
|
327
|
+
|
328
|
+
|
329
|
+
<li class="protected ">
|
330
|
+
<span class="summary_signature">
|
331
|
+
|
332
|
+
<a href="#assert_not_empty-instance_method" title="#assert_not_empty (instance method)">- (Object) <strong>assert_not_empty</strong>(path, message = nil) </a>
|
333
|
+
|
334
|
+
|
335
|
+
|
336
|
+
</span>
|
337
|
+
|
338
|
+
|
339
|
+
<span class="note title protected">protected</span>
|
340
|
+
|
341
|
+
|
342
|
+
|
343
|
+
|
344
|
+
|
345
|
+
<span class="summary_desc"><div class='inline'>
|
346
|
+
<p>Assert that a file exists at <tt>path</tt> and is not empty.</p>
|
347
|
+
</div></span>
|
348
|
+
|
349
|
+
</li>
|
350
|
+
|
351
|
+
|
352
|
+
<li class="protected ">
|
353
|
+
<span class="summary_signature">
|
354
|
+
|
355
|
+
<a href="#clear_tasks-instance_method" title="#clear_tasks (instance method)">- (Object) <strong>clear_tasks</strong> </a>
|
356
|
+
|
357
|
+
|
358
|
+
|
359
|
+
</span>
|
360
|
+
|
361
|
+
|
362
|
+
<span class="note title protected">protected</span>
|
363
|
+
|
364
|
+
|
365
|
+
|
366
|
+
|
367
|
+
|
368
|
+
<span class="summary_desc"><div class='inline'>
|
369
|
+
<p>Clear all registered Rake tasks.</p>
|
370
|
+
</div></span>
|
371
|
+
|
372
|
+
</li>
|
373
|
+
|
374
|
+
|
375
|
+
<li class="protected ">
|
376
|
+
<span class="summary_signature">
|
377
|
+
|
378
|
+
<a href="#create_file-instance_method" title="#create_file (instance method)">- (File) <strong>create_file</strong>(path) </a>
|
379
|
+
|
380
|
+
|
381
|
+
|
382
|
+
</span>
|
383
|
+
|
384
|
+
|
385
|
+
<span class="note title protected">protected</span>
|
386
|
+
|
387
|
+
|
388
|
+
|
389
|
+
|
390
|
+
|
391
|
+
<span class="summary_desc"><div class='inline'>
|
392
|
+
<p>Create an empty file at <tt>path</tt>.</p>
|
393
|
+
</div></span>
|
394
|
+
|
395
|
+
</li>
|
396
|
+
|
397
|
+
|
398
|
+
<li class="public ">
|
399
|
+
<span class="summary_signature">
|
400
|
+
|
401
|
+
<a href="#fixtures-instance_method" title="#fixtures (instance method)">- (Dir) <strong>fixtures</strong>(from = nil) </a>
|
402
|
+
|
403
|
+
|
404
|
+
|
405
|
+
</span>
|
406
|
+
|
407
|
+
|
408
|
+
|
409
|
+
|
410
|
+
|
411
|
+
|
412
|
+
|
413
|
+
|
414
|
+
<span class="summary_desc"><div class='inline'>
|
415
|
+
<p>the text case that calls this method.</p>
|
416
|
+
</div></span>
|
417
|
+
|
418
|
+
</li>
|
419
|
+
|
420
|
+
|
421
|
+
<li class="protected ">
|
422
|
+
<span class="summary_signature">
|
423
|
+
|
424
|
+
<a href="#get_task-instance_method" title="#get_task (instance method)">- (Rake::Task) <strong>get_task</strong>(name) </a>
|
425
|
+
|
426
|
+
|
427
|
+
|
428
|
+
</span>
|
429
|
+
|
430
|
+
|
431
|
+
<span class="note title protected">protected</span>
|
432
|
+
|
433
|
+
|
434
|
+
|
435
|
+
|
436
|
+
|
437
|
+
<span class="summary_desc"><div class='inline'>
|
438
|
+
<p>Retrieve a registered Rake task by name.</p>
|
439
|
+
</div></span>
|
440
|
+
|
441
|
+
</li>
|
442
|
+
|
443
|
+
|
444
|
+
<li class="protected ">
|
445
|
+
<span class="summary_signature">
|
446
|
+
|
447
|
+
<a href="#make_temp_folder-instance_method" title="#make_temp_folder (instance method)">- (Dir) <strong>make_temp_folder</strong>(from) </a>
|
448
|
+
|
449
|
+
|
450
|
+
|
451
|
+
</span>
|
452
|
+
|
453
|
+
|
454
|
+
<span class="note title protected">protected</span>
|
455
|
+
|
456
|
+
|
457
|
+
|
458
|
+
|
459
|
+
|
460
|
+
<span class="summary_desc"><div class='inline'>
|
461
|
+
<p>Create a temporary folder relative to the provided path.</p>
|
462
|
+
</div></span>
|
463
|
+
|
464
|
+
</li>
|
465
|
+
|
466
|
+
|
467
|
+
<li class="protected ">
|
468
|
+
<span class="summary_signature">
|
469
|
+
|
470
|
+
<a href="#remove_file-instance_method" title="#remove_file (instance method)">- (Object) <strong>remove_file</strong>(path = nil) </a>
|
471
|
+
|
472
|
+
|
473
|
+
|
474
|
+
</span>
|
475
|
+
|
476
|
+
|
477
|
+
<span class="note title protected">protected</span>
|
478
|
+
|
479
|
+
|
480
|
+
|
481
|
+
|
482
|
+
|
483
|
+
<span class="summary_desc"><div class='inline'>
|
484
|
+
<p>Remove a file if it exists.</p>
|
485
|
+
</div></span>
|
486
|
+
|
487
|
+
</li>
|
488
|
+
|
489
|
+
|
490
|
+
<li class="protected ">
|
491
|
+
<span class="summary_signature">
|
492
|
+
|
493
|
+
<a href="#run_task-instance_method" title="#run_task (instance method)">- (Rake::Task) <strong>run_task</strong>(name) </a>
|
494
|
+
|
495
|
+
|
496
|
+
|
497
|
+
</span>
|
498
|
+
|
499
|
+
|
500
|
+
<span class="note title protected">protected</span>
|
501
|
+
|
502
|
+
|
503
|
+
|
504
|
+
|
505
|
+
|
506
|
+
<span class="summary_desc"><div class='inline'>
|
507
|
+
<p>Invoke a Rake task by name.</p>
|
508
|
+
</div></span>
|
509
|
+
|
510
|
+
</li>
|
511
|
+
|
512
|
+
|
513
|
+
<li class="public ">
|
514
|
+
<span class="summary_signature">
|
515
|
+
|
516
|
+
<a href="#setup-instance_method" title="#setup (instance method)">- (Object) <strong>setup</strong> </a>
|
517
|
+
|
518
|
+
|
519
|
+
|
520
|
+
</span>
|
521
|
+
|
522
|
+
|
523
|
+
|
524
|
+
|
525
|
+
|
526
|
+
|
527
|
+
|
528
|
+
|
529
|
+
<span class="summary_desc"><div class='inline'>
|
530
|
+
<p>Override the setup method in order to record the working directory before
|
531
|
+
the test method runs.</p>
|
532
|
+
</div></span>
|
533
|
+
|
534
|
+
</li>
|
535
|
+
|
536
|
+
|
537
|
+
<li class="public ">
|
538
|
+
<span class="summary_signature">
|
539
|
+
|
540
|
+
<a href="#skip-instance_method" title="#skip (instance method)">- (Object) <strong>skip</strong>(message = "") </a>
|
541
|
+
|
542
|
+
|
543
|
+
|
544
|
+
</span>
|
545
|
+
|
546
|
+
|
547
|
+
|
548
|
+
|
549
|
+
|
550
|
+
|
551
|
+
|
552
|
+
|
553
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
554
|
+
|
555
|
+
</li>
|
556
|
+
|
557
|
+
|
558
|
+
<li class="public ">
|
559
|
+
<span class="summary_signature">
|
560
|
+
|
561
|
+
<a href="#teardown-instance_method" title="#teardown (instance method)">- (Object) <strong>teardown</strong> </a>
|
562
|
+
|
563
|
+
|
564
|
+
|
565
|
+
</span>
|
566
|
+
|
567
|
+
|
568
|
+
|
569
|
+
|
570
|
+
|
571
|
+
|
572
|
+
|
573
|
+
|
574
|
+
<span class="summary_desc"><div class='inline'>
|
575
|
+
<p>Override the teardown method in order to perform systemic cleanup work
|
576
|
+
like, clearing lingering rake tasks, and removing temporary folders.</p>
|
577
|
+
</div></span>
|
578
|
+
|
579
|
+
</li>
|
580
|
+
|
581
|
+
|
582
|
+
<li class="protected ">
|
583
|
+
<span class="summary_signature">
|
584
|
+
|
585
|
+
<a href="#temp_cache-instance_method" title="#temp_cache (instance method)">- (Dir) <strong>temp_cache</strong> </a>
|
586
|
+
|
587
|
+
|
588
|
+
|
589
|
+
</span>
|
590
|
+
|
591
|
+
|
592
|
+
<span class="note title protected">protected</span>
|
593
|
+
|
594
|
+
|
595
|
+
|
596
|
+
|
597
|
+
|
598
|
+
<span class="summary_desc"><div class='inline'>
|
599
|
+
<p>Create and/or return sprout/cache directory relative to the fixtures folder
|
600
|
+
nearest the file that calls this method.</p>
|
601
|
+
</div></span>
|
602
|
+
|
603
|
+
</li>
|
604
|
+
|
605
|
+
|
606
|
+
<li class="protected ">
|
607
|
+
<span class="summary_signature">
|
608
|
+
|
609
|
+
<a href="#temp_path-instance_method" title="#temp_path (instance method)">- (Dir) <strong>temp_path</strong> </a>
|
610
|
+
|
611
|
+
|
612
|
+
|
613
|
+
</span>
|
614
|
+
|
615
|
+
|
616
|
+
<span class="note title protected">protected</span>
|
617
|
+
|
618
|
+
|
619
|
+
|
620
|
+
|
621
|
+
|
622
|
+
<span class="summary_desc"><div class='inline'>
|
623
|
+
<p>Create a temporary folder relative to the test case that calls this method.</p>
|
624
|
+
</div></span>
|
625
|
+
|
626
|
+
</li>
|
627
|
+
|
628
|
+
|
629
|
+
</ul>
|
630
|
+
|
631
|
+
|
632
|
+
|
633
|
+
|
634
|
+
|
635
|
+
<div id="instance_method_details" class="method_details_list">
|
636
|
+
<h2>Instance Method Details</h2>
|
637
|
+
|
638
|
+
|
639
|
+
<div class="method_details first">
|
640
|
+
<p class="signature first" id="as_a_mac_system-instance_method">
|
641
|
+
|
642
|
+
- (<tt><span class='object_link'><a href="System/OSXSystem.html" title="Sprout::System::OSXSystem (class)">Sprout::System::OSXSystem</a></span></tt>) <strong>as_a_mac_system</strong> {|Sprout::System::OSXSystem| ... } <span class="extras">(protected)</span>
|
643
|
+
|
644
|
+
|
645
|
+
|
646
|
+
</p><div class="docstring">
|
647
|
+
<div class="discussion">
|
648
|
+
|
649
|
+
<p>Execute a block as a OSXSystem.</p>
|
650
|
+
|
651
|
+
<pre class="code"><span class='id as_a_mac_system'>as_a_mac_system</span> <span class='kw'>do</span>
|
652
|
+
<span class='id puts'>puts</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>>> Sprout.home: </span><span class='embexpr_beg'>#{</span><span class='const'>Sprout</span><span class='period'>.</span><span class='id home'>home</span><span class='rbrace'>}</span><span class='tstring_end'>"</span></span>
|
653
|
+
<span class='kw'>end</span></pre>
|
654
|
+
|
655
|
+
|
656
|
+
</div>
|
657
|
+
</div>
|
658
|
+
<div class="tags">
|
659
|
+
<h3>Yields:</h3>
|
660
|
+
<ul class="yield">
|
661
|
+
|
662
|
+
<li>
|
663
|
+
|
664
|
+
<span class='type'>(<tt><span class='object_link'><a href="System/OSXSystem.html" title="Sprout::System::OSXSystem (class)">Sprout::System::OSXSystem</a></span></tt>)</span>
|
665
|
+
|
666
|
+
|
667
|
+
|
668
|
+
|
669
|
+
—
|
670
|
+
<div class='inline'>
|
671
|
+
<p>The current Sprout::System.</p>
|
672
|
+
</div>
|
673
|
+
|
674
|
+
</li>
|
675
|
+
|
676
|
+
</ul>
|
677
|
+
<h3>Returns:</h3>
|
678
|
+
<ul class="return">
|
679
|
+
|
680
|
+
<li>
|
681
|
+
|
682
|
+
<span class='type'>(<tt><span class='object_link'><a href="System/OSXSystem.html" title="Sprout::System::OSXSystem (class)">Sprout::System::OSXSystem</a></span></tt>)</span>
|
683
|
+
|
684
|
+
|
685
|
+
|
686
|
+
|
687
|
+
—
|
688
|
+
<div class='inline'>
|
689
|
+
<p>The Sprout::System that was created.</p>
|
690
|
+
</div>
|
691
|
+
|
692
|
+
</li>
|
693
|
+
|
694
|
+
</ul>
|
695
|
+
|
696
|
+
</div><table class="source_code">
|
697
|
+
<tr>
|
698
|
+
<td>
|
699
|
+
<pre class="lines">
|
700
|
+
|
701
|
+
|
702
|
+
312
|
703
|
+
313
|
704
|
+
314
|
705
|
+
315
|
706
|
+
316
|
707
|
+
317
|
708
|
+
318
|
709
|
+
319
|
710
|
+
320
|
711
|
+
321</pre>
|
712
|
+
</td>
|
713
|
+
<td>
|
714
|
+
<pre class="code"><span class="info file"># File 'lib/sprout/test_helper.rb', line 312</span>
|
715
|
+
|
716
|
+
<span class='kw'>def</span> <span class='id as_a_mac_system'>as_a_mac_system</span>
|
717
|
+
<span class='id sys'>sys</span> <span class='op'>=</span> <span class='const'>Sprout</span><span class='op'>::</span><span class='const'>System</span><span class='op'>::</span><span class='const'>OSXSystem</span><span class='period'>.</span><span class='id new'>new</span>
|
718
|
+
<span class='const'>Sprout</span><span class='op'>::</span><span class='const'>System</span><span class='period'>.</span><span class='id stubs'>stubs</span><span class='lparen'>(</span><span class='symbol'>:create</span><span class='rparen'>)</span><span class='period'>.</span><span class='id returns'>returns</span> <span class='id sys'>sys</span>
|
719
|
+
<span class='kw'>yield</span> <span class='id sys'>sys</span> <span class='kw'>if</span> <span class='id block_given?'>block_given?</span>
|
720
|
+
<span class='comment'># Ugh - This is way too greedy... We're killing all mocks in here
|
721
|
+
</span> <span class='comment'># Doing it anyway b/c we need to get Windows support in place...
|
722
|
+
</span> <span class='comment'># TODO: Implement this feature without clobbering all stubs/mocks
|
723
|
+
</span> <span class='comment'>#Mocha::Mockery.instance.teardown
|
724
|
+
</span> <span class='id sys'>sys</span>
|
725
|
+
<span class='kw'>end</span></pre>
|
726
|
+
</td>
|
727
|
+
</tr>
|
728
|
+
</table>
|
729
|
+
</div>
|
730
|
+
|
731
|
+
<div class="method_details ">
|
732
|
+
<p class="signature " id="as_a_unix_system-instance_method">
|
733
|
+
|
734
|
+
- (<tt><span class='object_link'><a href="System/UnixSystem.html" title="Sprout::System::UnixSystem (class)">Sprout::System::UnixSystem</a></span></tt>) <strong>as_a_unix_system</strong> {|Sprout::System::UnixSystem| ... } <span class="extras">(protected)</span>
|
735
|
+
|
736
|
+
|
737
|
+
|
738
|
+
</p><div class="docstring">
|
739
|
+
<div class="discussion">
|
740
|
+
|
741
|
+
<p>Execute a block as a UnixSystem.</p>
|
742
|
+
|
743
|
+
<pre class="code"><span class='id as_a_unix_system'>as_a_unix_system</span> <span class='kw'>do</span>
|
744
|
+
<span class='id puts'>puts</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>>> Sprout.home: </span><span class='embexpr_beg'>#{</span><span class='const'>Sprout</span><span class='period'>.</span><span class='id home'>home</span><span class='rbrace'>}</span><span class='tstring_end'>"</span></span>
|
745
|
+
<span class='kw'>end</span></pre>
|
746
|
+
|
747
|
+
|
748
|
+
</div>
|
749
|
+
</div>
|
750
|
+
<div class="tags">
|
751
|
+
<h3>Yields:</h3>
|
752
|
+
<ul class="yield">
|
753
|
+
|
754
|
+
<li>
|
755
|
+
|
756
|
+
<span class='type'>(<tt><span class='object_link'><a href="System/UnixSystem.html" title="Sprout::System::UnixSystem (class)">Sprout::System::UnixSystem</a></span></tt>)</span>
|
757
|
+
|
758
|
+
|
759
|
+
|
760
|
+
|
761
|
+
—
|
762
|
+
<div class='inline'>
|
763
|
+
<p>The current Sprout::System.</p>
|
764
|
+
</div>
|
765
|
+
|
766
|
+
</li>
|
767
|
+
|
768
|
+
</ul>
|
769
|
+
<h3>Returns:</h3>
|
770
|
+
<ul class="return">
|
771
|
+
|
772
|
+
<li>
|
773
|
+
|
774
|
+
<span class='type'>(<tt><span class='object_link'><a href="System/UnixSystem.html" title="Sprout::System::UnixSystem (class)">Sprout::System::UnixSystem</a></span></tt>)</span>
|
775
|
+
|
776
|
+
|
777
|
+
|
778
|
+
|
779
|
+
—
|
780
|
+
<div class='inline'>
|
781
|
+
<p>The Sprout::System that was created.</p>
|
782
|
+
</div>
|
783
|
+
|
784
|
+
</li>
|
785
|
+
|
786
|
+
</ul>
|
787
|
+
|
788
|
+
</div><table class="source_code">
|
789
|
+
<tr>
|
790
|
+
<td>
|
791
|
+
<pre class="lines">
|
792
|
+
|
793
|
+
|
794
|
+
292
|
795
|
+
293
|
796
|
+
294
|
797
|
+
295
|
798
|
+
296
|
799
|
+
297
|
800
|
+
298
|
801
|
+
299
|
802
|
+
300
|
803
|
+
301</pre>
|
804
|
+
</td>
|
805
|
+
<td>
|
806
|
+
<pre class="code"><span class="info file"># File 'lib/sprout/test_helper.rb', line 292</span>
|
807
|
+
|
808
|
+
<span class='kw'>def</span> <span class='id as_a_unix_system'>as_a_unix_system</span>
|
809
|
+
<span class='id sys'>sys</span> <span class='op'>=</span> <span class='const'>Sprout</span><span class='op'>::</span><span class='const'>System</span><span class='op'>::</span><span class='const'>UnixSystem</span><span class='period'>.</span><span class='id new'>new</span>
|
810
|
+
<span class='id expectation'>expectation</span> <span class='op'>=</span> <span class='const'>Sprout</span><span class='op'>::</span><span class='const'>System</span><span class='period'>.</span><span class='id stubs'>stubs</span><span class='lparen'>(</span><span class='symbol'>:create</span><span class='rparen'>)</span><span class='period'>.</span><span class='id returns'>returns</span> <span class='id sys'>sys</span>
|
811
|
+
<span class='kw'>yield</span> <span class='id sys'>sys</span> <span class='kw'>if</span> <span class='id block_given?'>block_given?</span>
|
812
|
+
<span class='comment'># Ugh - This is way too greedy... We're killing all mocks in here
|
813
|
+
</span> <span class='comment'># Doing it anyway b/c we need to get Windows support in place...
|
814
|
+
</span> <span class='comment'># TODO: Implement this feature without clobbering all stubs/mocks
|
815
|
+
</span> <span class='comment'>#Mocha::Mockery.instance.teardown
|
816
|
+
</span> <span class='id sys'>sys</span>
|
817
|
+
<span class='kw'>end</span></pre>
|
818
|
+
</td>
|
819
|
+
</tr>
|
820
|
+
</table>
|
821
|
+
</div>
|
822
|
+
|
823
|
+
<div class="method_details ">
|
824
|
+
<p class="signature " id="as_a_win_nix_system-instance_method">
|
825
|
+
|
826
|
+
- (<tt><span class='object_link'><a href="System/WinNixSystem.html" title="Sprout::System::WinNixSystem (class)">Sprout::System::WinNixSystem</a></span></tt>) <strong>as_a_win_nix_system</strong> {|Sprout::System::WinNixSystem| ... } <span class="extras">(protected)</span>
|
827
|
+
|
828
|
+
|
829
|
+
|
830
|
+
</p><div class="docstring">
|
831
|
+
<div class="discussion">
|
832
|
+
|
833
|
+
<p>Execute a block as a WinNixSystem.</p>
|
834
|
+
|
835
|
+
<pre class="code"><span class='id as_a_win_nix_system'>as_a_win_nix_system</span> <span class='kw'>do</span>
|
836
|
+
<span class='id puts'>puts</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>>> Sprout.home: </span><span class='embexpr_beg'>#{</span><span class='const'>Sprout</span><span class='period'>.</span><span class='id home'>home</span><span class='rbrace'>}</span><span class='tstring_end'>"</span></span>
|
837
|
+
<span class='kw'>end</span></pre>
|
838
|
+
|
839
|
+
|
840
|
+
</div>
|
841
|
+
</div>
|
842
|
+
<div class="tags">
|
843
|
+
<h3>Yields:</h3>
|
844
|
+
<ul class="yield">
|
845
|
+
|
846
|
+
<li>
|
847
|
+
|
848
|
+
<span class='type'>(<tt><span class='object_link'><a href="System/WinNixSystem.html" title="Sprout::System::WinNixSystem (class)">Sprout::System::WinNixSystem</a></span></tt>)</span>
|
849
|
+
|
850
|
+
|
851
|
+
|
852
|
+
|
853
|
+
—
|
854
|
+
<div class='inline'>
|
855
|
+
<p>The current Sprout::System.</p>
|
856
|
+
</div>
|
857
|
+
|
858
|
+
</li>
|
859
|
+
|
860
|
+
</ul>
|
861
|
+
<h3>Returns:</h3>
|
862
|
+
<ul class="return">
|
863
|
+
|
864
|
+
<li>
|
865
|
+
|
866
|
+
<span class='type'>(<tt><span class='object_link'><a href="System/WinNixSystem.html" title="Sprout::System::WinNixSystem (class)">Sprout::System::WinNixSystem</a></span></tt>)</span>
|
867
|
+
|
868
|
+
|
869
|
+
|
870
|
+
|
871
|
+
—
|
872
|
+
<div class='inline'>
|
873
|
+
<p>The Sprout::System that was created.</p>
|
874
|
+
</div>
|
875
|
+
|
876
|
+
</li>
|
877
|
+
|
878
|
+
</ul>
|
879
|
+
|
880
|
+
</div><table class="source_code">
|
881
|
+
<tr>
|
882
|
+
<td>
|
883
|
+
<pre class="lines">
|
884
|
+
|
885
|
+
|
886
|
+
352
|
887
|
+
353
|
888
|
+
354
|
889
|
+
355
|
890
|
+
356
|
891
|
+
357
|
892
|
+
358
|
893
|
+
359
|
894
|
+
360
|
895
|
+
361</pre>
|
896
|
+
</td>
|
897
|
+
<td>
|
898
|
+
<pre class="code"><span class="info file"># File 'lib/sprout/test_helper.rb', line 352</span>
|
899
|
+
|
900
|
+
<span class='kw'>def</span> <span class='id as_a_win_nix_system'>as_a_win_nix_system</span>
|
901
|
+
<span class='id sys'>sys</span> <span class='op'>=</span> <span class='const'>Sprout</span><span class='op'>::</span><span class='const'>System</span><span class='op'>::</span><span class='const'>WinNixSystem</span><span class='period'>.</span><span class='id new'>new</span>
|
902
|
+
<span class='const'>Sprout</span><span class='op'>::</span><span class='const'>System</span><span class='period'>.</span><span class='id stubs'>stubs</span><span class='lparen'>(</span><span class='symbol'>:create</span><span class='rparen'>)</span><span class='period'>.</span><span class='id returns'>returns</span> <span class='id sys'>sys</span>
|
903
|
+
<span class='kw'>yield</span> <span class='id sys'>sys</span> <span class='kw'>if</span> <span class='id block_given?'>block_given?</span>
|
904
|
+
<span class='comment'># Ugh - This is way too greedy... We're killing all mocks in here
|
905
|
+
</span> <span class='comment'># Doing it anyway b/c we need to get Windows support in place...
|
906
|
+
</span> <span class='comment'># TODO: Implement this feature without clobbering all stubs/mocks
|
907
|
+
</span> <span class='comment'>#Mocha::Mockery.instance.teardown
|
908
|
+
</span> <span class='id sys'>sys</span>
|
909
|
+
<span class='kw'>end</span></pre>
|
910
|
+
</td>
|
911
|
+
</tr>
|
912
|
+
</table>
|
913
|
+
</div>
|
914
|
+
|
915
|
+
<div class="method_details ">
|
916
|
+
<p class="signature " id="as_a_windows_system-instance_method">
|
917
|
+
|
918
|
+
- (<tt><span class='object_link'><a href="System/WinSystem.html" title="Sprout::System::WinSystem (class)">Sprout::System::WinSystem</a></span></tt>) <strong>as_a_windows_system</strong> {|Sprout::System::WinSystem| ... } <span class="extras">(protected)</span>
|
919
|
+
|
920
|
+
|
921
|
+
|
922
|
+
</p><div class="docstring">
|
923
|
+
<div class="discussion">
|
924
|
+
|
925
|
+
<p>Execute a block as a WinSystem.</p>
|
926
|
+
|
927
|
+
<pre class="code"><span class='id as_a_windows_system'>as_a_windows_system</span> <span class='kw'>do</span>
|
928
|
+
<span class='id puts'>puts</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>>> Sprout.home: </span><span class='embexpr_beg'>#{</span><span class='const'>Sprout</span><span class='period'>.</span><span class='id home'>home</span><span class='rbrace'>}</span><span class='tstring_end'>"</span></span>
|
929
|
+
<span class='kw'>end</span></pre>
|
930
|
+
|
931
|
+
|
932
|
+
</div>
|
933
|
+
</div>
|
934
|
+
<div class="tags">
|
935
|
+
<h3>Yields:</h3>
|
936
|
+
<ul class="yield">
|
937
|
+
|
938
|
+
<li>
|
939
|
+
|
940
|
+
<span class='type'>(<tt><span class='object_link'><a href="System/WinSystem.html" title="Sprout::System::WinSystem (class)">Sprout::System::WinSystem</a></span></tt>)</span>
|
941
|
+
|
942
|
+
|
943
|
+
|
944
|
+
|
945
|
+
—
|
946
|
+
<div class='inline'>
|
947
|
+
<p>The current Sprout::System.</p>
|
948
|
+
</div>
|
949
|
+
|
950
|
+
</li>
|
951
|
+
|
952
|
+
</ul>
|
953
|
+
<h3>Returns:</h3>
|
954
|
+
<ul class="return">
|
955
|
+
|
956
|
+
<li>
|
957
|
+
|
958
|
+
<span class='type'>(<tt><span class='object_link'><a href="System/WinSystem.html" title="Sprout::System::WinSystem (class)">Sprout::System::WinSystem</a></span></tt>)</span>
|
959
|
+
|
960
|
+
|
961
|
+
|
962
|
+
|
963
|
+
—
|
964
|
+
<div class='inline'>
|
965
|
+
<p>The Sprout::System that was created.</p>
|
966
|
+
</div>
|
967
|
+
|
968
|
+
</li>
|
969
|
+
|
970
|
+
</ul>
|
971
|
+
|
972
|
+
</div><table class="source_code">
|
973
|
+
<tr>
|
974
|
+
<td>
|
975
|
+
<pre class="lines">
|
976
|
+
|
977
|
+
|
978
|
+
332
|
979
|
+
333
|
980
|
+
334
|
981
|
+
335
|
982
|
+
336
|
983
|
+
337
|
984
|
+
338
|
985
|
+
339
|
986
|
+
340
|
987
|
+
341</pre>
|
988
|
+
</td>
|
989
|
+
<td>
|
990
|
+
<pre class="code"><span class="info file"># File 'lib/sprout/test_helper.rb', line 332</span>
|
991
|
+
|
992
|
+
<span class='kw'>def</span> <span class='id as_a_windows_system'>as_a_windows_system</span>
|
993
|
+
<span class='id sys'>sys</span> <span class='op'>=</span> <span class='const'>Sprout</span><span class='op'>::</span><span class='const'>System</span><span class='op'>::</span><span class='const'>WinSystem</span><span class='period'>.</span><span class='id new'>new</span>
|
994
|
+
<span class='const'>Sprout</span><span class='op'>::</span><span class='const'>System</span><span class='period'>.</span><span class='id stubs'>stubs</span><span class='lparen'>(</span><span class='symbol'>:create</span><span class='rparen'>)</span><span class='period'>.</span><span class='id returns'>returns</span> <span class='id sys'>sys</span>
|
995
|
+
<span class='kw'>yield</span> <span class='id sys'>sys</span> <span class='kw'>if</span> <span class='id block_given?'>block_given?</span>
|
996
|
+
<span class='comment'># Ugh - This is way too greedy... We're killing all mocks in here
|
997
|
+
</span> <span class='comment'># Doing it anyway b/c we need to get Windows support in place...
|
998
|
+
</span> <span class='comment'># TODO: Implement this feature without clobbering all stubs/mocks
|
999
|
+
</span> <span class='comment'>#Mocha::Mockery.instance.teardown
|
1000
|
+
</span> <span class='id sys'>sys</span>
|
1001
|
+
<span class='kw'>end</span></pre>
|
1002
|
+
</td>
|
1003
|
+
</tr>
|
1004
|
+
</table>
|
1005
|
+
</div>
|
1006
|
+
|
1007
|
+
<div class="method_details ">
|
1008
|
+
<p class="signature " id="as_each_system-instance_method">
|
1009
|
+
|
1010
|
+
- (<tt><span class='object_link'><a href="System/BaseSystem.html" title="Sprout::System::BaseSystem (class)">Sprout::System::BaseSystem</a></span></tt>) <strong>as_each_system</strong> {|Sprout::System::BaseSystem| ... } <span class="extras">(protected)</span>
|
1011
|
+
|
1012
|
+
|
1013
|
+
|
1014
|
+
</p><div class="docstring">
|
1015
|
+
<div class="discussion">
|
1016
|
+
|
1017
|
+
<p>Execute a block as each available Sprout::System, any code within this
|
1018
|
+
block that calls Sprout.current_user will receive the currently active
|
1019
|
+
Sprout::System.</p>
|
1020
|
+
|
1021
|
+
<pre class="code"><span class='id as_each_system'>as_each_system</span> <span class='kw'>do</span>
|
1022
|
+
<span class='id puts'>puts</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>>> Sprout.home: </span><span class='embexpr_beg'>#{</span><span class='const'>Sprout</span><span class='period'>.</span><span class='id home'>home</span><span class='rbrace'>}</span><span class='tstring_end'>"</span></span>
|
1023
|
+
<span class='kw'>end</span></pre>
|
1024
|
+
|
1025
|
+
<p>This method is primarily used to ensure that we create system-appropriate
|
1026
|
+
paths and processes.</p>
|
1027
|
+
|
1028
|
+
<p>NOTE: This process automatically calls Mocha::Mockery.instance.teardown
|
1029
|
+
after the yield. This means that any mocks that have been created will no
|
1030
|
+
longer be available after the provided block is complete.</p>
|
1031
|
+
|
1032
|
+
|
1033
|
+
</div>
|
1034
|
+
</div>
|
1035
|
+
<div class="tags">
|
1036
|
+
<h3>Yields:</h3>
|
1037
|
+
<ul class="yield">
|
1038
|
+
|
1039
|
+
<li>
|
1040
|
+
|
1041
|
+
<span class='type'>(<tt><span class='object_link'><a href="System/BaseSystem.html" title="Sprout::System::BaseSystem (class)">Sprout::System::BaseSystem</a></span></tt>)</span>
|
1042
|
+
|
1043
|
+
|
1044
|
+
|
1045
|
+
|
1046
|
+
—
|
1047
|
+
<div class='inline'>
|
1048
|
+
<p>The concrete subclass of BaseSystem</p>
|
1049
|
+
</div>
|
1050
|
+
|
1051
|
+
</li>
|
1052
|
+
|
1053
|
+
</ul>
|
1054
|
+
<h3>Returns:</h3>
|
1055
|
+
<ul class="return">
|
1056
|
+
|
1057
|
+
<li>
|
1058
|
+
|
1059
|
+
<span class='type'>(<tt><span class='object_link'><a href="System/BaseSystem.html" title="Sprout::System::BaseSystem (class)">Sprout::System::BaseSystem</a></span></tt>)</span>
|
1060
|
+
|
1061
|
+
|
1062
|
+
|
1063
|
+
|
1064
|
+
—
|
1065
|
+
<div class='inline'>
|
1066
|
+
<p>The concrete class that was created.</p>
|
1067
|
+
</div>
|
1068
|
+
|
1069
|
+
</li>
|
1070
|
+
|
1071
|
+
</ul>
|
1072
|
+
|
1073
|
+
</div><table class="source_code">
|
1074
|
+
<tr>
|
1075
|
+
<td>
|
1076
|
+
<pre class="lines">
|
1077
|
+
|
1078
|
+
|
1079
|
+
264
|
1080
|
+
265
|
1081
|
+
266
|
1082
|
+
267
|
1083
|
+
268
|
1084
|
+
269
|
1085
|
+
270
|
1086
|
+
271
|
1087
|
+
272
|
1088
|
+
273
|
1089
|
+
274
|
1090
|
+
275
|
1091
|
+
276
|
1092
|
+
277
|
1093
|
+
278
|
1094
|
+
279
|
1095
|
+
280
|
1096
|
+
281</pre>
|
1097
|
+
</td>
|
1098
|
+
<td>
|
1099
|
+
<pre class="code"><span class="info file"># File 'lib/sprout/test_helper.rb', line 264</span>
|
1100
|
+
|
1101
|
+
<span class='kw'>def</span> <span class='id as_each_system'>as_each_system</span>
|
1102
|
+
<span class='lbracket'>[</span>
|
1103
|
+
<span class='const'>Sprout</span><span class='op'>::</span><span class='const'>System</span><span class='op'>::</span><span class='const'>VistaSystem</span><span class='period'>.</span><span class='id new'>new</span><span class='comma'>,</span>
|
1104
|
+
<span class='const'>Sprout</span><span class='op'>::</span><span class='const'>System</span><span class='op'>::</span><span class='const'>WinNixSystem</span><span class='period'>.</span><span class='id new'>new</span><span class='comma'>,</span>
|
1105
|
+
<span class='const'>Sprout</span><span class='op'>::</span><span class='const'>System</span><span class='op'>::</span><span class='const'>WinSystem</span><span class='period'>.</span><span class='id new'>new</span><span class='comma'>,</span>
|
1106
|
+
<span class='const'>Sprout</span><span class='op'>::</span><span class='const'>System</span><span class='op'>::</span><span class='const'>JavaSystem</span><span class='period'>.</span><span class='id new'>new</span><span class='comma'>,</span>
|
1107
|
+
<span class='const'>Sprout</span><span class='op'>::</span><span class='const'>System</span><span class='op'>::</span><span class='const'>OSXSystem</span><span class='period'>.</span><span class='id new'>new</span><span class='comma'>,</span>
|
1108
|
+
<span class='const'>Sprout</span><span class='op'>::</span><span class='const'>System</span><span class='op'>::</span><span class='const'>UnixSystem</span><span class='period'>.</span><span class='id new'>new</span>
|
1109
|
+
<span class='rbracket'>]</span><span class='period'>.</span><span class='id each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id sys'>sys</span><span class='op'>|</span>
|
1110
|
+
<span class='id expectation'>expectation</span> <span class='op'>=</span> <span class='const'>Sprout</span><span class='op'>::</span><span class='const'>System</span><span class='period'>.</span><span class='id stubs'>stubs</span><span class='lparen'>(</span><span class='symbol'>:create</span><span class='rparen'>)</span><span class='period'>.</span><span class='id returns'>returns</span> <span class='id sys'>sys</span>
|
1111
|
+
<span class='kw'>yield</span> <span class='id sys'>sys</span> <span class='kw'>if</span> <span class='id block_given?'>block_given?</span>
|
1112
|
+
<span class='comment'># Ugh - This is way too greedy... We're killing all mocks in here
|
1113
|
+
</span> <span class='comment'># Doing it anyway b/c we need to get Windows support in place...
|
1114
|
+
</span> <span class='comment'># TODO: Implement this feature without clobbering all stubs/mocks
|
1115
|
+
</span> <span class='const'>Mocha</span><span class='op'>::</span><span class='const'>Mockery</span><span class='period'>.</span><span class='id instance'>instance</span><span class='period'>.</span><span class='id teardown'>teardown</span>
|
1116
|
+
<span class='id sys'>sys</span>
|
1117
|
+
<span class='kw'>end</span>
|
1118
|
+
<span class='kw'>end</span></pre>
|
1119
|
+
</td>
|
1120
|
+
</tr>
|
1121
|
+
</table>
|
1122
|
+
</div>
|
1123
|
+
|
1124
|
+
<div class="method_details ">
|
1125
|
+
<p class="signature " id="assert_directory-instance_method">
|
1126
|
+
|
1127
|
+
- (<tt>Object</tt>) <strong>assert_directory</strong>(path, message = nil) <span class="extras">(protected)</span>
|
1128
|
+
|
1129
|
+
|
1130
|
+
|
1131
|
+
</p><div class="docstring">
|
1132
|
+
<div class="discussion">
|
1133
|
+
|
1134
|
+
<p>Assert that a directory exists at <tt>path</tt> and display
|
1135
|
+
<tt>message</tt> if it does not.</p>
|
1136
|
+
|
1137
|
+
|
1138
|
+
</div>
|
1139
|
+
</div>
|
1140
|
+
<div class="tags">
|
1141
|
+
<h3>Parameters:</h3>
|
1142
|
+
<ul class="param">
|
1143
|
+
|
1144
|
+
<li>
|
1145
|
+
|
1146
|
+
<span class='type'>(<tt><span class='object_link'><a href="../Dir.html" title="Dir (class)">Dir</a></span></tt>)</span>
|
1147
|
+
|
1148
|
+
|
1149
|
+
<span class='name'>path</span>
|
1150
|
+
|
1151
|
+
|
1152
|
+
|
1153
|
+
—
|
1154
|
+
<div class='inline'>
|
1155
|
+
<p>Path to the directory that should exist.</p>
|
1156
|
+
</div>
|
1157
|
+
|
1158
|
+
</li>
|
1159
|
+
|
1160
|
+
<li>
|
1161
|
+
|
1162
|
+
<span class='type'>(<tt><span class='object_link'><a href="../String.html" title="String (class)">String</a></span></tt>)</span>
|
1163
|
+
|
1164
|
+
|
1165
|
+
<span class='name'>message</span>
|
1166
|
+
|
1167
|
+
|
1168
|
+
<em class="default">(defaults to: <tt>nil</tt>)</em>
|
1169
|
+
|
1170
|
+
|
1171
|
+
—
|
1172
|
+
<div class='inline'>
|
1173
|
+
<p>The message that should be displayed if the expected directory does not
|
1174
|
+
exist.</p>
|
1175
|
+
|
1176
|
+
<p>assert_directory File.join(fixtures, 'SomeDir')</p>
|
1177
|
+
</div>
|
1178
|
+
|
1179
|
+
</li>
|
1180
|
+
|
1181
|
+
</ul>
|
1182
|
+
|
1183
|
+
</div><table class="source_code">
|
1184
|
+
<tr>
|
1185
|
+
<td>
|
1186
|
+
<pre class="lines">
|
1187
|
+
|
1188
|
+
|
1189
|
+
198
|
1190
|
+
199
|
1191
|
+
200
|
1192
|
+
201</pre>
|
1193
|
+
</td>
|
1194
|
+
<td>
|
1195
|
+
<pre class="code"><span class="info file"># File 'lib/sprout/test_helper.rb', line 198</span>
|
1196
|
+
|
1197
|
+
<span class='kw'>def</span> <span class='id assert_directory'>assert_directory</span><span class='lparen'>(</span><span class='id path'>path</span><span class='comma'>,</span> <span class='id message'>message</span><span class='op'>=</span><span class='kw'>nil</span><span class='rparen'>)</span>
|
1198
|
+
<span class='id message'>message</span> <span class='op'>||=</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Expected directory not found at </span><span class='embexpr_beg'>#{</span><span class='id path'>path</span><span class='rbrace'>}</span><span class='tstring_end'>"</span></span>
|
1199
|
+
<span class='id assert'>assert</span><span class='lparen'>(</span><span class='const'>File</span><span class='period'>.</span><span class='id directory?'>directory?</span><span class='lparen'>(</span><span class='id path'>path</span><span class='rparen'>)</span><span class='comma'>,</span> <span class='id message'>message</span><span class='rparen'>)</span>
|
1200
|
+
<span class='kw'>end</span></pre>
|
1201
|
+
</td>
|
1202
|
+
</tr>
|
1203
|
+
</table>
|
1204
|
+
</div>
|
1205
|
+
|
1206
|
+
<div class="method_details ">
|
1207
|
+
<p class="signature " id="assert_file-instance_method">
|
1208
|
+
|
1209
|
+
- (<tt>Object</tt>) <strong>assert_file</strong>(path, message = nil) {|String| ... } <span class="extras">(protected)</span>
|
1210
|
+
|
1211
|
+
|
1212
|
+
|
1213
|
+
</p><div class="docstring">
|
1214
|
+
<div class="discussion">
|
1215
|
+
|
1216
|
+
<p>Assert that a file exists at <tt>path</tt> and display <tt>message</tt> if
|
1217
|
+
it does not.</p>
|
1218
|
+
|
1219
|
+
<p>This method yields the file contents so that you can write readable tests
|
1220
|
+
like:</p>
|
1221
|
+
|
1222
|
+
<pre class="code"><span class='id assert_file'>assert_file</span> <span class='const'>File</span><span class='period'>.</span><span class='id join'>join</span><span class='lparen'>(</span><span class='id fixtures'>fixtures</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>my_file</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id f'>f</span><span class='op'>|</span>
|
1223
|
+
<span class='id assert_matches'>assert_matches</span> <span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>Johnny</span><span class='regexp_end'>/</span></span><span class='comma'>,</span> <span class='id f'>f</span>
|
1224
|
+
<span class='kw'>end</span></pre>
|
1225
|
+
|
1226
|
+
|
1227
|
+
</div>
|
1228
|
+
</div>
|
1229
|
+
<div class="tags">
|
1230
|
+
<h3>Parameters:</h3>
|
1231
|
+
<ul class="param">
|
1232
|
+
|
1233
|
+
<li>
|
1234
|
+
|
1235
|
+
<span class='type'>(<tt>File</tt>)</span>
|
1236
|
+
|
1237
|
+
|
1238
|
+
<span class='name'>path</span>
|
1239
|
+
|
1240
|
+
|
1241
|
+
|
1242
|
+
—
|
1243
|
+
<div class='inline'>
|
1244
|
+
<p>Path to the file that should exist.</p>
|
1245
|
+
</div>
|
1246
|
+
|
1247
|
+
</li>
|
1248
|
+
|
1249
|
+
<li>
|
1250
|
+
|
1251
|
+
<span class='type'>(<tt><span class='object_link'><a href="../String.html" title="String (class)">String</a></span></tt>)</span>
|
1252
|
+
|
1253
|
+
|
1254
|
+
<span class='name'>message</span>
|
1255
|
+
|
1256
|
+
|
1257
|
+
<em class="default">(defaults to: <tt>nil</tt>)</em>
|
1258
|
+
|
1259
|
+
|
1260
|
+
—
|
1261
|
+
<div class='inline'>
|
1262
|
+
<p>The message that should be displayed if the expected file does not exist.</p>
|
1263
|
+
</div>
|
1264
|
+
|
1265
|
+
</li>
|
1266
|
+
|
1267
|
+
</ul>
|
1268
|
+
<h3>Yields:</h3>
|
1269
|
+
<ul class="yield">
|
1270
|
+
|
1271
|
+
<li>
|
1272
|
+
|
1273
|
+
<span class='type'>(<tt><span class='object_link'><a href="../String.html" title="String (class)">String</a></span></tt>)</span>
|
1274
|
+
|
1275
|
+
|
1276
|
+
|
1277
|
+
|
1278
|
+
—
|
1279
|
+
<div class='inline'>
|
1280
|
+
<p>The contents of the file.</p>
|
1281
|
+
</div>
|
1282
|
+
|
1283
|
+
</li>
|
1284
|
+
|
1285
|
+
</ul>
|
1286
|
+
|
1287
|
+
</div><table class="source_code">
|
1288
|
+
<tr>
|
1289
|
+
<td>
|
1290
|
+
<pre class="lines">
|
1291
|
+
|
1292
|
+
|
1293
|
+
183
|
1294
|
+
184
|
1295
|
+
185
|
1296
|
+
186
|
1297
|
+
187</pre>
|
1298
|
+
</td>
|
1299
|
+
<td>
|
1300
|
+
<pre class="code"><span class="info file"># File 'lib/sprout/test_helper.rb', line 183</span>
|
1301
|
+
|
1302
|
+
<span class='kw'>def</span> <span class='id assert_file'>assert_file</span><span class='lparen'>(</span><span class='id path'>path</span><span class='comma'>,</span> <span class='id message'>message</span><span class='op'>=</span><span class='kw'>nil</span><span class='rparen'>)</span>
|
1303
|
+
<span class='id message'>message</span> <span class='op'>||=</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Expected file not found at </span><span class='embexpr_beg'>#{</span><span class='id path'>path</span><span class='rbrace'>}</span><span class='tstring_end'>"</span></span>
|
1304
|
+
<span class='id assert'>assert</span><span class='lparen'>(</span><span class='const'>File</span><span class='period'>.</span><span class='id exists?'>exists?</span><span class='lparen'>(</span><span class='id path'>path</span><span class='rparen'>)</span><span class='comma'>,</span> <span class='id message'>message</span><span class='rparen'>)</span>
|
1305
|
+
<span class='kw'>yield</span> <span class='const'>File</span><span class='period'>.</span><span class='id read'>read</span><span class='lparen'>(</span><span class='id path'>path</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id block_given?'>block_given?</span>
|
1306
|
+
<span class='kw'>end</span></pre>
|
1307
|
+
</td>
|
1308
|
+
</tr>
|
1309
|
+
</table>
|
1310
|
+
</div>
|
1311
|
+
|
1312
|
+
<div class="method_details ">
|
1313
|
+
<p class="signature " id="assert_matches-instance_method">
|
1314
|
+
|
1315
|
+
- (<tt>Object</tt>) <strong>assert_matches</strong>(expression, string, message = '') <span class="extras">(protected)</span>
|
1316
|
+
|
1317
|
+
|
1318
|
+
|
1319
|
+
</p><div class="docstring">
|
1320
|
+
<div class="discussion">
|
1321
|
+
|
1322
|
+
<p>Assert that an expression matches the provided string.</p>
|
1323
|
+
|
1324
|
+
<p>This helper mainly makes tests more readable and provides simpler failure
|
1325
|
+
messages without extra work.</p>
|
1326
|
+
|
1327
|
+
<pre class="code"><span class='id assert_matches'>assert_matches</span> <span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>Fred</span><span class='regexp_end'>/</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>Bill, Fred, Bob</span><span class='tstring_end'>'</span></span></pre>
|
1328
|
+
|
1329
|
+
|
1330
|
+
</div>
|
1331
|
+
</div>
|
1332
|
+
<div class="tags">
|
1333
|
+
|
1334
|
+
</div><table class="source_code">
|
1335
|
+
<tr>
|
1336
|
+
<td>
|
1337
|
+
<pre class="lines">
|
1338
|
+
|
1339
|
+
|
1340
|
+
227
|
1341
|
+
228
|
1342
|
+
229
|
1343
|
+
230
|
1344
|
+
231
|
1345
|
+
232
|
1346
|
+
233
|
1347
|
+
234</pre>
|
1348
|
+
</td>
|
1349
|
+
<td>
|
1350
|
+
<pre class="code"><span class="info file"># File 'lib/sprout/test_helper.rb', line 227</span>
|
1351
|
+
|
1352
|
+
<span class='kw'>def</span> <span class='id assert_matches'>assert_matches</span><span class='lparen'>(</span><span class='id expression'>expression</span><span class='comma'>,</span> <span class='id string'>string</span><span class='comma'>,</span> <span class='id message'>message</span><span class='op'>=</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span>
|
1353
|
+
<span class='kw'>if</span><span class='lparen'>(</span><span class='id expression'>expression</span><span class='period'>.</span><span class='id is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>String</span><span class='rparen'>)</span><span class='rparen'>)</span>
|
1354
|
+
<span class='id expresion'>expresion</span> <span class='op'>=</span> <span class='tstring'><span class='regexp_beg'>/</span><span class='embexpr_beg'>#{</span><span class='id expression'>expression</span><span class='rbrace'>}</span><span class='regexp_end'>/</span></span>
|
1355
|
+
<span class='kw'>end</span>
|
1356
|
+
<span class='kw'>if</span><span class='lparen'>(</span><span class='op'>!</span><span class='id string'>string</span><span class='period'>.</span><span class='id match'>match</span><span class='lparen'>(</span><span class='id expression'>expression</span><span class='rparen'>)</span><span class='rparen'>)</span>
|
1357
|
+
<span class='id fail'>fail</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='embexpr_beg'>#{</span><span class='id message'>message</span><span class='rbrace'>}</span><span class='tstring_content'> - '</span><span class='embexpr_beg'>#{</span><span class='id string'>string</span><span class='rbrace'>}</span><span class='tstring_content'>' should include '</span><span class='embexpr_beg'>#{</span><span class='id expression'>expression</span><span class='rbrace'>}</span><span class='tstring_content'>'</span><span class='tstring_end'>"</span></span>
|
1358
|
+
<span class='kw'>end</span>
|
1359
|
+
<span class='kw'>end</span></pre>
|
1360
|
+
</td>
|
1361
|
+
</tr>
|
1362
|
+
</table>
|
1363
|
+
</div>
|
1364
|
+
|
1365
|
+
<div class="method_details ">
|
1366
|
+
<p class="signature " id="assert_not_empty-instance_method">
|
1367
|
+
|
1368
|
+
- (<tt>Object</tt>) <strong>assert_not_empty</strong>(path, message = nil) <span class="extras">(protected)</span>
|
1369
|
+
|
1370
|
+
|
1371
|
+
|
1372
|
+
</p><div class="docstring">
|
1373
|
+
<div class="discussion">
|
1374
|
+
|
1375
|
+
<p>Assert that a file exists at <tt>path</tt> and is not empty. Display
|
1376
|
+
<tt>message</tt> if the file does not exist or if it is empty.</p>
|
1377
|
+
|
1378
|
+
|
1379
|
+
</div>
|
1380
|
+
</div>
|
1381
|
+
<div class="tags">
|
1382
|
+
<h3>Parameters:</h3>
|
1383
|
+
<ul class="param">
|
1384
|
+
|
1385
|
+
<li>
|
1386
|
+
|
1387
|
+
<span class='type'>(<tt>File</tt>)</span>
|
1388
|
+
|
1389
|
+
|
1390
|
+
<span class='name'>path</span>
|
1391
|
+
|
1392
|
+
|
1393
|
+
|
1394
|
+
—
|
1395
|
+
<div class='inline'>
|
1396
|
+
<p>Path to the file that should exist.</p>
|
1397
|
+
</div>
|
1398
|
+
|
1399
|
+
</li>
|
1400
|
+
|
1401
|
+
<li>
|
1402
|
+
|
1403
|
+
<span class='type'>(<tt><span class='object_link'><a href="../String.html" title="String (class)">String</a></span></tt>)</span>
|
1404
|
+
|
1405
|
+
|
1406
|
+
<span class='name'>message</span>
|
1407
|
+
|
1408
|
+
|
1409
|
+
<em class="default">(defaults to: <tt>nil</tt>)</em>
|
1410
|
+
|
1411
|
+
|
1412
|
+
—
|
1413
|
+
<div class='inline'>
|
1414
|
+
<p>The message that should be displayed if the expected file does not exist
|
1415
|
+
or is empty.</p>
|
1416
|
+
|
1417
|
+
<p>assert_not_empty File.join(fixtures, 'SomeFile')</p>
|
1418
|
+
</div>
|
1419
|
+
|
1420
|
+
</li>
|
1421
|
+
|
1422
|
+
</ul>
|
1423
|
+
|
1424
|
+
</div><table class="source_code">
|
1425
|
+
<tr>
|
1426
|
+
<td>
|
1427
|
+
<pre class="lines">
|
1428
|
+
|
1429
|
+
|
1430
|
+
212
|
1431
|
+
213
|
1432
|
+
214
|
1433
|
+
215
|
1434
|
+
216
|
1435
|
+
217</pre>
|
1436
|
+
</td>
|
1437
|
+
<td>
|
1438
|
+
<pre class="code"><span class="info file"># File 'lib/sprout/test_helper.rb', line 212</span>
|
1439
|
+
|
1440
|
+
<span class='kw'>def</span> <span class='id assert_not_empty'>assert_not_empty</span><span class='lparen'>(</span><span class='id path'>path</span><span class='comma'>,</span> <span class='id message'>message</span><span class='op'>=</span><span class='kw'>nil</span><span class='rparen'>)</span>
|
1441
|
+
<span class='id assert_file'>assert_file</span> <span class='id path'>path</span><span class='comma'>,</span> <span class='id message'>message</span>
|
1442
|
+
<span class='id files'>files</span> <span class='op'>=</span> <span class='const'>FileList</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>"</span><span class='embexpr_beg'>#{</span><span class='id path'>path</span><span class='rbrace'>}</span><span class='tstring_content'>/*</span><span class='tstring_end'>"</span></span><span class='rbracket'>]</span>
|
1443
|
+
<span class='id message'>message</span> <span class='op'>||=</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'> - Expected </span><span class='embexpr_beg'>#{</span><span class='id path'>path</span><span class='rbrace'>}</span><span class='tstring_content'> to not be empty, but it was</span><span class='tstring_end'>"</span></span>
|
1444
|
+
<span class='id assert'>assert</span> <span class='id files'>files</span><span class='period'>.</span><span class='id size'>size</span> <span class='op'>></span> <span class='int'>0</span><span class='comma'>,</span> <span class='id message'>message</span>
|
1445
|
+
<span class='kw'>end</span></pre>
|
1446
|
+
</td>
|
1447
|
+
</tr>
|
1448
|
+
</table>
|
1449
|
+
</div>
|
1450
|
+
|
1451
|
+
<div class="method_details ">
|
1452
|
+
<p class="signature " id="clear_tasks-instance_method">
|
1453
|
+
|
1454
|
+
- (<tt>Object</tt>) <strong>clear_tasks</strong> <span class="extras">(protected)</span>
|
1455
|
+
|
1456
|
+
|
1457
|
+
|
1458
|
+
</p><div class="docstring">
|
1459
|
+
<div class="discussion">
|
1460
|
+
|
1461
|
+
<p>Clear all registered Rake tasks.</p>
|
1462
|
+
|
1463
|
+
|
1464
|
+
</div>
|
1465
|
+
</div>
|
1466
|
+
<div class="tags">
|
1467
|
+
|
1468
|
+
</div><table class="source_code">
|
1469
|
+
<tr>
|
1470
|
+
<td>
|
1471
|
+
<pre class="lines">
|
1472
|
+
|
1473
|
+
|
1474
|
+
140
|
1475
|
+
141
|
1476
|
+
142
|
1477
|
+
143
|
1478
|
+
144</pre>
|
1479
|
+
</td>
|
1480
|
+
<td>
|
1481
|
+
<pre class="code"><span class="info file"># File 'lib/sprout/test_helper.rb', line 140</span>
|
1482
|
+
|
1483
|
+
<span class='kw'>def</span> <span class='id clear_tasks'>clear_tasks</span>
|
1484
|
+
<span class='const'>CLEAN</span><span class='period'>.</span><span class='id delete_if'>delete_if</span> <span class='lbrace'>{</span><span class='op'>|</span><span class='id a'>a</span><span class='op'>|</span> <span class='kw'>true</span> <span class='rbrace'>}</span>
|
1485
|
+
<span class='const'>Rake</span><span class='op'>::</span><span class='const'>Task</span><span class='period'>.</span><span class='id clear'>clear</span>
|
1486
|
+
<span class='const'>Rake</span><span class='period'>.</span><span class='id application'>application</span><span class='period'>.</span><span class='id clear'>clear</span>
|
1487
|
+
<span class='kw'>end</span></pre>
|
1488
|
+
</td>
|
1489
|
+
</tr>
|
1490
|
+
</table>
|
1491
|
+
</div>
|
1492
|
+
|
1493
|
+
<div class="method_details ">
|
1494
|
+
<p class="signature " id="create_file-instance_method">
|
1495
|
+
|
1496
|
+
- (<tt>File</tt>) <strong>create_file</strong>(path) <span class="extras">(protected)</span>
|
1497
|
+
|
1498
|
+
|
1499
|
+
|
1500
|
+
</p><div class="docstring">
|
1501
|
+
<div class="discussion">
|
1502
|
+
|
1503
|
+
<p>Create an empty file at <tt>path</tt></p>
|
1504
|
+
|
1505
|
+
|
1506
|
+
</div>
|
1507
|
+
</div>
|
1508
|
+
<div class="tags">
|
1509
|
+
<h3>Parameters:</h3>
|
1510
|
+
<ul class="param">
|
1511
|
+
|
1512
|
+
<li>
|
1513
|
+
|
1514
|
+
<span class='type'>(<tt>File</tt>)</span>
|
1515
|
+
|
1516
|
+
|
1517
|
+
<span class='name'>The</span>
|
1518
|
+
|
1519
|
+
|
1520
|
+
|
1521
|
+
—
|
1522
|
+
<div class='inline'>
|
1523
|
+
<p>path to the file that should be created.</p>
|
1524
|
+
</div>
|
1525
|
+
|
1526
|
+
</li>
|
1527
|
+
|
1528
|
+
</ul>
|
1529
|
+
<h3>Returns:</h3>
|
1530
|
+
<ul class="return">
|
1531
|
+
|
1532
|
+
<li>
|
1533
|
+
|
1534
|
+
<span class='type'>(<tt>File</tt>)</span>
|
1535
|
+
|
1536
|
+
|
1537
|
+
|
1538
|
+
|
1539
|
+
—
|
1540
|
+
<div class='inline'>
|
1541
|
+
<p>The path to the file.</p>
|
1542
|
+
</div>
|
1543
|
+
|
1544
|
+
</li>
|
1545
|
+
|
1546
|
+
</ul>
|
1547
|
+
|
1548
|
+
</div><table class="source_code">
|
1549
|
+
<tr>
|
1550
|
+
<td>
|
1551
|
+
<pre class="lines">
|
1552
|
+
|
1553
|
+
|
1554
|
+
151
|
1555
|
+
152
|
1556
|
+
153
|
1557
|
+
154
|
1558
|
+
155</pre>
|
1559
|
+
</td>
|
1560
|
+
<td>
|
1561
|
+
<pre class="code"><span class="info file"># File 'lib/sprout/test_helper.rb', line 151</span>
|
1562
|
+
|
1563
|
+
<span class='kw'>def</span> <span class='id create_file'>create_file</span> <span class='id path'>path</span>
|
1564
|
+
<span class='id dir'>dir</span> <span class='op'>=</span> <span class='const'>File</span><span class='period'>.</span><span class='id dirname'>dirname</span> <span class='id path'>path</span>
|
1565
|
+
<span class='const'>FileUtils</span><span class='period'>.</span><span class='id mkdir_p'>mkdir_p</span> <span class='id dir'>dir</span>
|
1566
|
+
<span class='const'>FileUtils</span><span class='period'>.</span><span class='id touch'>touch</span> <span class='id path'>path</span>
|
1567
|
+
<span class='kw'>end</span></pre>
|
1568
|
+
</td>
|
1569
|
+
</tr>
|
1570
|
+
</table>
|
1571
|
+
</div>
|
1572
|
+
|
1573
|
+
<div class="method_details ">
|
1574
|
+
<p class="signature " id="fixtures-instance_method">
|
1575
|
+
|
1576
|
+
- (<tt><span class='object_link'><a href="../Dir.html" title="Dir (class)">Dir</a></span></tt>) <strong>fixtures</strong>(from = nil)
|
1577
|
+
|
1578
|
+
|
1579
|
+
|
1580
|
+
</p><div class="docstring">
|
1581
|
+
<div class="discussion">
|
1582
|
+
|
1583
|
+
<p>the text case that calls this method.</p>
|
1584
|
+
|
1585
|
+
|
1586
|
+
</div>
|
1587
|
+
</div>
|
1588
|
+
<div class="tags">
|
1589
|
+
<h3>Returns:</h3>
|
1590
|
+
<ul class="return">
|
1591
|
+
|
1592
|
+
<li>
|
1593
|
+
|
1594
|
+
<span class='type'>(<tt><span class='object_link'><a href="../Dir.html" title="Dir (class)">Dir</a></span></tt>)</span>
|
1595
|
+
|
1596
|
+
|
1597
|
+
|
1598
|
+
|
1599
|
+
—
|
1600
|
+
<div class='inline'>
|
1601
|
+
<p>Path to a fixtures folder that is next to</p>
|
1602
|
+
</div>
|
1603
|
+
|
1604
|
+
</li>
|
1605
|
+
|
1606
|
+
</ul>
|
1607
|
+
|
1608
|
+
</div><table class="source_code">
|
1609
|
+
<tr>
|
1610
|
+
<td>
|
1611
|
+
<pre class="lines">
|
1612
|
+
|
1613
|
+
|
1614
|
+
56
|
1615
|
+
57
|
1616
|
+
58</pre>
|
1617
|
+
</td>
|
1618
|
+
<td>
|
1619
|
+
<pre class="code"><span class="info file"># File 'lib/sprout/test_helper.rb', line 56</span>
|
1620
|
+
|
1621
|
+
<span class='kw'>def</span> <span class='id fixtures'>fixtures</span> <span class='id from'>from</span><span class='op'>=</span><span class='kw'>nil</span>
|
1622
|
+
<span class='ivar'>@fixtures</span> <span class='op'>||=</span> <span class='id find_fixtures'>find_fixtures</span><span class='lparen'>(</span><span class='id from'>from</span> <span class='op'>||</span> <span class='const'>Sprout</span><span class='period'>.</span><span class='id file_from_caller'>file_from_caller</span><span class='lparen'>(</span><span class='id caller'>caller</span><span class='period'>.</span><span class='id first'>first</span><span class='rparen'>)</span><span class='rparen'>)</span>
|
1623
|
+
<span class='kw'>end</span></pre>
|
1624
|
+
</td>
|
1625
|
+
</tr>
|
1626
|
+
</table>
|
1627
|
+
</div>
|
1628
|
+
|
1629
|
+
<div class="method_details ">
|
1630
|
+
<p class="signature " id="get_task-instance_method">
|
1631
|
+
|
1632
|
+
- (<tt><span class='object_link'><a href="../Rake/Task.html" title="Rake::Task (class)">Rake::Task</a></span></tt>) <strong>get_task</strong>(name) <span class="extras">(protected)</span>
|
1633
|
+
|
1634
|
+
|
1635
|
+
|
1636
|
+
</p><div class="docstring">
|
1637
|
+
<div class="discussion">
|
1638
|
+
|
1639
|
+
<p>Retrieve a registered Rake task by name.</p>
|
1640
|
+
|
1641
|
+
|
1642
|
+
</div>
|
1643
|
+
</div>
|
1644
|
+
<div class="tags">
|
1645
|
+
<h3>Returns:</h3>
|
1646
|
+
<ul class="return">
|
1647
|
+
|
1648
|
+
<li>
|
1649
|
+
|
1650
|
+
<span class='type'>(<tt><span class='object_link'><a href="../Rake/Task.html" title="Rake::Task (class)">Rake::Task</a></span></tt>)</span>
|
1651
|
+
|
1652
|
+
|
1653
|
+
|
1654
|
+
|
1655
|
+
—
|
1656
|
+
<div class='inline'>
|
1657
|
+
<p>The task that was found.</p>
|
1658
|
+
</div>
|
1659
|
+
|
1660
|
+
</li>
|
1661
|
+
|
1662
|
+
</ul>
|
1663
|
+
|
1664
|
+
</div><table class="source_code">
|
1665
|
+
<tr>
|
1666
|
+
<td>
|
1667
|
+
<pre class="lines">
|
1668
|
+
|
1669
|
+
|
1670
|
+
134
|
1671
|
+
135
|
1672
|
+
136</pre>
|
1673
|
+
</td>
|
1674
|
+
<td>
|
1675
|
+
<pre class="code"><span class="info file"># File 'lib/sprout/test_helper.rb', line 134</span>
|
1676
|
+
|
1677
|
+
<span class='kw'>def</span> <span class='id get_task'>get_task</span><span class='lparen'>(</span><span class='id name'>name</span><span class='rparen'>)</span>
|
1678
|
+
<span class='kw'>return</span> <span class='const'>Rake</span><span class='period'>.</span><span class='id application'>application</span><span class='lbracket'>[</span><span class='id name'>name</span><span class='rbracket'>]</span>
|
1679
|
+
<span class='kw'>end</span></pre>
|
1680
|
+
</td>
|
1681
|
+
</tr>
|
1682
|
+
</table>
|
1683
|
+
</div>
|
1684
|
+
|
1685
|
+
<div class="method_details ">
|
1686
|
+
<p class="signature " id="make_temp_folder-instance_method">
|
1687
|
+
|
1688
|
+
- (<tt><span class='object_link'><a href="../Dir.html" title="Dir (class)">Dir</a></span></tt>) <strong>make_temp_folder</strong>(from) <span class="extras">(protected)</span>
|
1689
|
+
|
1690
|
+
|
1691
|
+
|
1692
|
+
</p><div class="docstring">
|
1693
|
+
<div class="discussion">
|
1694
|
+
|
1695
|
+
<p>Create a temporary folder relative to the provided path.</p>
|
1696
|
+
|
1697
|
+
|
1698
|
+
</div>
|
1699
|
+
</div>
|
1700
|
+
<div class="tags">
|
1701
|
+
<h3>Parameters:</h3>
|
1702
|
+
<ul class="param">
|
1703
|
+
|
1704
|
+
<li>
|
1705
|
+
|
1706
|
+
<span class='type'>(<tt><span class='object_link'><a href="../Dir.html" title="Dir (class)">Dir</a></span></tt>)</span>
|
1707
|
+
|
1708
|
+
|
1709
|
+
<span class='name'>from</span>
|
1710
|
+
|
1711
|
+
|
1712
|
+
|
1713
|
+
—
|
1714
|
+
<div class='inline'>
|
1715
|
+
<p>Folder within which a 'tmp' folder should be added.</p>
|
1716
|
+
</div>
|
1717
|
+
|
1718
|
+
</li>
|
1719
|
+
|
1720
|
+
</ul>
|
1721
|
+
<h3>Returns:</h3>
|
1722
|
+
<ul class="return">
|
1723
|
+
|
1724
|
+
<li>
|
1725
|
+
|
1726
|
+
<span class='type'>(<tt><span class='object_link'><a href="../Dir.html" title="Dir (class)">Dir</a></span></tt>)</span>
|
1727
|
+
|
1728
|
+
|
1729
|
+
|
1730
|
+
|
1731
|
+
—
|
1732
|
+
<div class='inline'>
|
1733
|
+
<p>Path to the requested temp folder.</p>
|
1734
|
+
</div>
|
1735
|
+
|
1736
|
+
</li>
|
1737
|
+
|
1738
|
+
</ul>
|
1739
|
+
|
1740
|
+
</div><table class="source_code">
|
1741
|
+
<tr>
|
1742
|
+
<td>
|
1743
|
+
<pre class="lines">
|
1744
|
+
|
1745
|
+
|
1746
|
+
114
|
1747
|
+
115
|
1748
|
+
116
|
1749
|
+
117
|
1750
|
+
118</pre>
|
1751
|
+
</td>
|
1752
|
+
<td>
|
1753
|
+
<pre class="code"><span class="info file"># File 'lib/sprout/test_helper.rb', line 114</span>
|
1754
|
+
|
1755
|
+
<span class='kw'>def</span> <span class='id make_temp_folder'>make_temp_folder</span> <span class='id from'>from</span>
|
1756
|
+
<span class='id dir'>dir</span> <span class='op'>=</span> <span class='const'>File</span><span class='period'>.</span><span class='id join'>join</span><span class='lparen'>(</span><span class='id fixtures'>fixtures</span><span class='lparen'>(</span><span class='id from'>from</span><span class='rparen'>)</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>tmp</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span>
|
1757
|
+
<span class='const'>FileUtils</span><span class='period'>.</span><span class='id mkdir_p'>mkdir_p</span> <span class='id dir'>dir</span>
|
1758
|
+
<span class='id dir'>dir</span>
|
1759
|
+
<span class='kw'>end</span></pre>
|
1760
|
+
</td>
|
1761
|
+
</tr>
|
1762
|
+
</table>
|
1763
|
+
</div>
|
1764
|
+
|
1765
|
+
<div class="method_details ">
|
1766
|
+
<p class="signature " id="remove_file-instance_method">
|
1767
|
+
|
1768
|
+
- (<tt>Object</tt>) <strong>remove_file</strong>(path = nil) <span class="extras">(protected)</span>
|
1769
|
+
|
1770
|
+
|
1771
|
+
|
1772
|
+
</p><div class="docstring">
|
1773
|
+
<div class="discussion">
|
1774
|
+
|
1775
|
+
<p>Remove a file if it exists. If no file exists, do nothing.</p>
|
1776
|
+
|
1777
|
+
|
1778
|
+
</div>
|
1779
|
+
</div>
|
1780
|
+
<div class="tags">
|
1781
|
+
<h3>Parameters:</h3>
|
1782
|
+
<ul class="param">
|
1783
|
+
|
1784
|
+
<li>
|
1785
|
+
|
1786
|
+
<span class='type'>(<tt>File</tt>)</span>
|
1787
|
+
|
1788
|
+
|
1789
|
+
<span class='name'>path</span>
|
1790
|
+
|
1791
|
+
|
1792
|
+
<em class="default">(defaults to: <tt>nil</tt>)</em>
|
1793
|
+
|
1794
|
+
|
1795
|
+
—
|
1796
|
+
<div class='inline'>
|
1797
|
+
<p>Path to the file that should be removed.</p>
|
1798
|
+
</div>
|
1799
|
+
|
1800
|
+
</li>
|
1801
|
+
|
1802
|
+
</ul>
|
1803
|
+
|
1804
|
+
</div><table class="source_code">
|
1805
|
+
<tr>
|
1806
|
+
<td>
|
1807
|
+
<pre class="lines">
|
1808
|
+
|
1809
|
+
|
1810
|
+
162
|
1811
|
+
163
|
1812
|
+
164
|
1813
|
+
165
|
1814
|
+
166</pre>
|
1815
|
+
</td>
|
1816
|
+
<td>
|
1817
|
+
<pre class="code"><span class="info file"># File 'lib/sprout/test_helper.rb', line 162</span>
|
1818
|
+
|
1819
|
+
<span class='kw'>def</span> <span class='id remove_file'>remove_file</span><span class='lparen'>(</span><span class='id path'>path</span><span class='op'>=</span><span class='kw'>nil</span><span class='rparen'>)</span>
|
1820
|
+
<span class='kw'>if</span><span class='lparen'>(</span><span class='id path'>path</span> <span class='op'>&&</span> <span class='const'>File</span><span class='period'>.</span><span class='id exists?'>exists?</span><span class='lparen'>(</span><span class='id path'>path</span><span class='rparen'>)</span><span class='rparen'>)</span>
|
1821
|
+
<span class='const'>FileUtils</span><span class='period'>.</span><span class='id rm_rf'>rm_rf</span><span class='lparen'>(</span><span class='id path'>path</span><span class='rparen'>)</span>
|
1822
|
+
<span class='kw'>end</span>
|
1823
|
+
<span class='kw'>end</span></pre>
|
1824
|
+
</td>
|
1825
|
+
</tr>
|
1826
|
+
</table>
|
1827
|
+
</div>
|
1828
|
+
|
1829
|
+
<div class="method_details ">
|
1830
|
+
<p class="signature " id="run_task-instance_method">
|
1831
|
+
|
1832
|
+
- (<tt><span class='object_link'><a href="../Rake/Task.html" title="Rake::Task (class)">Rake::Task</a></span></tt>) <strong>run_task</strong>(name) <span class="extras">(protected)</span>
|
1833
|
+
|
1834
|
+
|
1835
|
+
|
1836
|
+
</p><div class="docstring">
|
1837
|
+
<div class="discussion">
|
1838
|
+
|
1839
|
+
<p>Invoke a Rake task by name.</p>
|
1840
|
+
|
1841
|
+
|
1842
|
+
</div>
|
1843
|
+
</div>
|
1844
|
+
<div class="tags">
|
1845
|
+
<h3>Returns:</h3>
|
1846
|
+
<ul class="return">
|
1847
|
+
|
1848
|
+
<li>
|
1849
|
+
|
1850
|
+
<span class='type'>(<tt><span class='object_link'><a href="../Rake/Task.html" title="Rake::Task (class)">Rake::Task</a></span></tt>)</span>
|
1851
|
+
|
1852
|
+
|
1853
|
+
|
1854
|
+
|
1855
|
+
—
|
1856
|
+
<div class='inline'>
|
1857
|
+
<p>The task that was invoked.</p>
|
1858
|
+
</div>
|
1859
|
+
|
1860
|
+
</li>
|
1861
|
+
|
1862
|
+
</ul>
|
1863
|
+
|
1864
|
+
</div><table class="source_code">
|
1865
|
+
<tr>
|
1866
|
+
<td>
|
1867
|
+
<pre class="lines">
|
1868
|
+
|
1869
|
+
|
1870
|
+
124
|
1871
|
+
125
|
1872
|
+
126
|
1873
|
+
127
|
1874
|
+
128</pre>
|
1875
|
+
</td>
|
1876
|
+
<td>
|
1877
|
+
<pre class="code"><span class="info file"># File 'lib/sprout/test_helper.rb', line 124</span>
|
1878
|
+
|
1879
|
+
<span class='kw'>def</span> <span class='id run_task'>run_task</span><span class='lparen'>(</span><span class='id name'>name</span><span class='rparen'>)</span>
|
1880
|
+
<span class='id t'>t</span> <span class='op'>=</span> <span class='const'>Rake</span><span class='period'>.</span><span class='id application'>application</span><span class='lbracket'>[</span><span class='id name'>name</span><span class='rbracket'>]</span>
|
1881
|
+
<span class='id t'>t</span><span class='period'>.</span><span class='id invoke'>invoke</span>
|
1882
|
+
<span class='kw'>return</span> <span class='id t'>t</span>
|
1883
|
+
<span class='kw'>end</span></pre>
|
1884
|
+
</td>
|
1885
|
+
</tr>
|
1886
|
+
</table>
|
1887
|
+
</div>
|
1888
|
+
|
1889
|
+
<div class="method_details ">
|
1890
|
+
<p class="signature " id="setup-instance_method">
|
1891
|
+
|
1892
|
+
- (<tt>Object</tt>) <strong>setup</strong>
|
1893
|
+
|
1894
|
+
|
1895
|
+
|
1896
|
+
</p><div class="docstring">
|
1897
|
+
<div class="discussion">
|
1898
|
+
|
1899
|
+
<p>Override the setup method in order to record the working directory before
|
1900
|
+
the test method runs.</p>
|
1901
|
+
|
1902
|
+
|
1903
|
+
</div>
|
1904
|
+
</div>
|
1905
|
+
<div class="tags">
|
1906
|
+
|
1907
|
+
</div><table class="source_code">
|
1908
|
+
<tr>
|
1909
|
+
<td>
|
1910
|
+
<pre class="lines">
|
1911
|
+
|
1912
|
+
|
1913
|
+
63
|
1914
|
+
64
|
1915
|
+
65
|
1916
|
+
66
|
1917
|
+
67
|
1918
|
+
68
|
1919
|
+
69
|
1920
|
+
70
|
1921
|
+
71
|
1922
|
+
72
|
1923
|
+
73</pre>
|
1924
|
+
</td>
|
1925
|
+
<td>
|
1926
|
+
<pre class="code"><span class="info file"># File 'lib/sprout/test_helper.rb', line 63</span>
|
1927
|
+
|
1928
|
+
<span class='kw'>def</span> <span class='id setup'>setup</span>
|
1929
|
+
<span class='kw'>super</span>
|
1930
|
+
|
1931
|
+
<span class='comment'># Prevent log messages from interrupting test output,
|
1932
|
+
</span> <span class='comment'># and create a pipe that test cases can read to ensure
|
1933
|
+
</span> <span class='comment'># user output is provided properly.
|
1934
|
+
</span> <span class='const'>Sprout</span><span class='period'>.</span><span class='id stdout'>stdout</span> <span class='op'>=</span> <span class='const'>Sprout</span><span class='op'>::</span><span class='const'>OutputBuffer</span><span class='period'>.</span><span class='id new'>new</span>
|
1935
|
+
<span class='const'>Sprout</span><span class='period'>.</span><span class='id stderr'>stderr</span> <span class='op'>=</span> <span class='const'>Sprout</span><span class='op'>::</span><span class='const'>OutputBuffer</span><span class='period'>.</span><span class='id new'>new</span>
|
1936
|
+
|
1937
|
+
<span class='ivar'>@start_path</span> <span class='op'>=</span> <span class='const'>Dir</span><span class='period'>.</span><span class='id pwd'>pwd</span>
|
1938
|
+
<span class='kw'>end</span></pre>
|
1939
|
+
</td>
|
1940
|
+
</tr>
|
1941
|
+
</table>
|
1942
|
+
</div>
|
1943
|
+
|
1944
|
+
<div class="method_details ">
|
1945
|
+
<p class="signature " id="skip-instance_method">
|
1946
|
+
|
1947
|
+
- (<tt>Object</tt>) <strong>skip</strong>(message = "")
|
1948
|
+
|
1949
|
+
|
1950
|
+
|
1951
|
+
</p><table class="source_code">
|
1952
|
+
<tr>
|
1953
|
+
<td>
|
1954
|
+
<pre class="lines">
|
1955
|
+
|
1956
|
+
|
1957
|
+
47
|
1958
|
+
48
|
1959
|
+
49
|
1960
|
+
50</pre>
|
1961
|
+
</td>
|
1962
|
+
<td>
|
1963
|
+
<pre class="code"><span class="info file"># File 'lib/sprout/test_helper.rb', line 47</span>
|
1964
|
+
|
1965
|
+
<span class='kw'>def</span> <span class='id skip'>skip</span> <span class='id message'>message</span><span class='op'>=</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_end'>"</span></span>
|
1966
|
+
<span class='id puts'>puts</span>
|
1967
|
+
<span class='id puts'>puts</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>>> SproutTestCase.skip called from: </span><span class='embexpr_beg'>#{</span><span class='id caller'>caller</span><span class='lbracket'>[</span><span class='int'>0</span><span class='rbracket'>]</span><span class='rbrace'>}</span><span class='tstring_content'> ( </span><span class='embexpr_beg'>#{</span><span class='id message'>message</span><span class='rbrace'>}</span><span class='tstring_content'> )</span><span class='tstring_end'>"</span></span>
|
1968
|
+
<span class='kw'>end</span></pre>
|
1969
|
+
</td>
|
1970
|
+
</tr>
|
1971
|
+
</table>
|
1972
|
+
</div>
|
1973
|
+
|
1974
|
+
<div class="method_details ">
|
1975
|
+
<p class="signature " id="teardown-instance_method">
|
1976
|
+
|
1977
|
+
- (<tt>Object</tt>) <strong>teardown</strong>
|
1978
|
+
|
1979
|
+
|
1980
|
+
|
1981
|
+
</p><div class="docstring">
|
1982
|
+
<div class="discussion">
|
1983
|
+
|
1984
|
+
<p>Override the teardown method in order to perform systemic cleanup work
|
1985
|
+
like, clearing lingering rake tasks, and removing temporary folders.</p>
|
1986
|
+
|
1987
|
+
|
1988
|
+
</div>
|
1989
|
+
</div>
|
1990
|
+
<div class="tags">
|
1991
|
+
|
1992
|
+
</div><table class="source_code">
|
1993
|
+
<tr>
|
1994
|
+
<td>
|
1995
|
+
<pre class="lines">
|
1996
|
+
|
1997
|
+
|
1998
|
+
79
|
1999
|
+
80
|
2000
|
+
81
|
2001
|
+
82
|
2002
|
+
83
|
2003
|
+
84
|
2004
|
+
85
|
2005
|
+
86
|
2006
|
+
87
|
2007
|
+
88
|
2008
|
+
89
|
2009
|
+
90
|
2010
|
+
91
|
2011
|
+
92
|
2012
|
+
93</pre>
|
2013
|
+
</td>
|
2014
|
+
<td>
|
2015
|
+
<pre class="code"><span class="info file"># File 'lib/sprout/test_helper.rb', line 79</span>
|
2016
|
+
|
2017
|
+
<span class='kw'>def</span> <span class='id teardown'>teardown</span>
|
2018
|
+
<span class='kw'>super</span>
|
2019
|
+
<span class='id clear_tasks'>clear_tasks</span>
|
2020
|
+
|
2021
|
+
<span class='id remove_file'>remove_file</span> <span class='ivar'>@temp_path</span>
|
2022
|
+
<span class='id remove_file'>remove_file</span> <span class='ivar'>@temp_cache</span>
|
2023
|
+
|
2024
|
+
<span class='ivar'>@temp_path</span> <span class='op'>=</span> <span class='kw'>nil</span>
|
2025
|
+
<span class='ivar'>@temp_cache</span> <span class='op'>=</span> <span class='kw'>nil</span>
|
2026
|
+
|
2027
|
+
<span class='kw'>if</span><span class='lparen'>(</span><span class='ivar'>@start_path</span> <span class='op'>&&</span> <span class='const'>Dir</span><span class='period'>.</span><span class='id pwd'>pwd</span> <span class='op'>!=</span> <span class='ivar'>@start_path</span><span class='rparen'>)</span>
|
2028
|
+
<span class='id puts'>puts</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>[WARNING] >> SproutTestCase changing dir from </span><span class='embexpr_beg'>#{</span><span class='const'>Dir</span><span class='period'>.</span><span class='id pwd'>pwd</span><span class='rbrace'>}</span><span class='tstring_content'> back to: </span><span class='embexpr_beg'>#{</span><span class='ivar'>@start_path</span><span class='rbrace'>}</span><span class='tstring_content'> - Did you mean to leave your working directory in a new place?</span><span class='tstring_end'>"</span></span>
|
2029
|
+
<span class='const'>Dir</span><span class='period'>.</span><span class='id chdir'>chdir</span> <span class='ivar'>@start_path</span>
|
2030
|
+
<span class='kw'>end</span>
|
2031
|
+
<span class='kw'>end</span></pre>
|
2032
|
+
</td>
|
2033
|
+
</tr>
|
2034
|
+
</table>
|
2035
|
+
</div>
|
2036
|
+
|
2037
|
+
<div class="method_details ">
|
2038
|
+
<p class="signature " id="temp_cache-instance_method">
|
2039
|
+
|
2040
|
+
- (<tt><span class='object_link'><a href="../Dir.html" title="Dir (class)">Dir</a></span></tt>) <strong>temp_cache</strong> <span class="extras">(protected)</span>
|
2041
|
+
|
2042
|
+
|
2043
|
+
|
2044
|
+
</p><div class="docstring">
|
2045
|
+
<div class="discussion">
|
2046
|
+
|
2047
|
+
<p>Create and/or return sprout/cache directory relative to the fixtures folder
|
2048
|
+
nearest the file that calls this method.</p>
|
2049
|
+
|
2050
|
+
|
2051
|
+
</div>
|
2052
|
+
</div>
|
2053
|
+
<div class="tags">
|
2054
|
+
<h3>Returns:</h3>
|
2055
|
+
<ul class="return">
|
2056
|
+
|
2057
|
+
<li>
|
2058
|
+
|
2059
|
+
<span class='type'>(<tt><span class='object_link'><a href="../Dir.html" title="Dir (class)">Dir</a></span></tt>)</span>
|
2060
|
+
|
2061
|
+
|
2062
|
+
|
2063
|
+
|
2064
|
+
—
|
2065
|
+
<div class='inline'>
|
2066
|
+
<p>The path to the cache directory.</p>
|
2067
|
+
</div>
|
2068
|
+
|
2069
|
+
</li>
|
2070
|
+
|
2071
|
+
</ul>
|
2072
|
+
|
2073
|
+
</div><table class="source_code">
|
2074
|
+
<tr>
|
2075
|
+
<td>
|
2076
|
+
<pre class="lines">
|
2077
|
+
|
2078
|
+
|
2079
|
+
240
|
2080
|
+
241
|
2081
|
+
242
|
2082
|
+
243</pre>
|
2083
|
+
</td>
|
2084
|
+
<td>
|
2085
|
+
<pre class="code"><span class="info file"># File 'lib/sprout/test_helper.rb', line 240</span>
|
2086
|
+
|
2087
|
+
<span class='kw'>def</span> <span class='id temp_cache'>temp_cache</span>
|
2088
|
+
<span class='id dir'>dir</span> <span class='op'>=</span> <span class='const'>File</span><span class='period'>.</span><span class='id dirname'>dirname</span><span class='lparen'>(</span><span class='const'>Sprout</span><span class='period'>.</span><span class='id file_from_caller'>file_from_caller</span><span class='lparen'>(</span><span class='id caller'>caller</span><span class='period'>.</span><span class='id first'>first</span><span class='rparen'>)</span><span class='rparen'>)</span>
|
2089
|
+
<span class='ivar'>@temp_cache</span> <span class='op'>||=</span> <span class='const'>File</span><span class='period'>.</span><span class='id join'>join</span><span class='lparen'>(</span><span class='id fixtures'>fixtures</span><span class='lparen'>(</span><span class='id dir'>dir</span><span class='rparen'>)</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>sprout</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>cache</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span>
|
2090
|
+
<span class='kw'>end</span></pre>
|
2091
|
+
</td>
|
2092
|
+
</tr>
|
2093
|
+
</table>
|
2094
|
+
</div>
|
2095
|
+
|
2096
|
+
<div class="method_details ">
|
2097
|
+
<p class="signature " id="temp_path-instance_method">
|
2098
|
+
|
2099
|
+
- (<tt><span class='object_link'><a href="../Dir.html" title="Dir (class)">Dir</a></span></tt>) <strong>temp_path</strong> <span class="extras">(protected)</span>
|
2100
|
+
|
2101
|
+
|
2102
|
+
|
2103
|
+
</p><div class="docstring">
|
2104
|
+
<div class="discussion">
|
2105
|
+
|
2106
|
+
<p>Create a temporary folder relative to the test case that calls this method.</p>
|
2107
|
+
|
2108
|
+
|
2109
|
+
</div>
|
2110
|
+
</div>
|
2111
|
+
<div class="tags">
|
2112
|
+
<h3>Returns:</h3>
|
2113
|
+
<ul class="return">
|
2114
|
+
|
2115
|
+
<li>
|
2116
|
+
|
2117
|
+
<span class='type'>(<tt><span class='object_link'><a href="../Dir.html" title="Dir (class)">Dir</a></span></tt>)</span>
|
2118
|
+
|
2119
|
+
|
2120
|
+
|
2121
|
+
|
2122
|
+
—
|
2123
|
+
<div class='inline'>
|
2124
|
+
<p>Path to the requested temp folder.</p>
|
2125
|
+
</div>
|
2126
|
+
|
2127
|
+
</li>
|
2128
|
+
|
2129
|
+
</ul>
|
2130
|
+
|
2131
|
+
</div><table class="source_code">
|
2132
|
+
<tr>
|
2133
|
+
<td>
|
2134
|
+
<pre class="lines">
|
2135
|
+
|
2136
|
+
|
2137
|
+
102
|
2138
|
+
103
|
2139
|
+
104
|
2140
|
+
105</pre>
|
2141
|
+
</td>
|
2142
|
+
<td>
|
2143
|
+
<pre class="code"><span class="info file"># File 'lib/sprout/test_helper.rb', line 102</span>
|
2144
|
+
|
2145
|
+
<span class='kw'>def</span> <span class='id temp_path'>temp_path</span>
|
2146
|
+
<span class='id caller_file'>caller_file</span> <span class='op'>=</span> <span class='const'>Sprout</span><span class='period'>.</span><span class='id file_from_caller'>file_from_caller</span> <span class='id caller'>caller</span><span class='period'>.</span><span class='id first'>first</span>
|
2147
|
+
<span class='ivar'>@temp_path</span> <span class='op'>||=</span> <span class='id make_temp_folder'>make_temp_folder</span> <span class='const'>File</span><span class='period'>.</span><span class='id dirname'>dirname</span><span class='lparen'>(</span><span class='id caller_file'>caller_file</span><span class='rparen'>)</span>
|
2148
|
+
<span class='kw'>end</span></pre>
|
2149
|
+
</td>
|
2150
|
+
</tr>
|
2151
|
+
</table>
|
2152
|
+
</div>
|
2153
|
+
|
2154
|
+
</div>
|
2155
|
+
|
2156
|
+
</div>
|
2157
|
+
|
2158
|
+
<div id="footer">
|
2159
|
+
Generated on Fri Apr 29 18:33:05 2011 by
|
2160
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
2161
|
+
0.6.3 (ruby-1.9.2).
|
2162
|
+
</div>
|
2163
|
+
|
2164
|
+
</body>
|
2165
|
+
</html>
|