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