rspec-core 2.3.1 → 2.4.0
Sign up to get free protection for your applications and to get access to all the features.
- data/History.markdown +22 -0
- data/Rakefile +2 -2
- data/features/command_line/README.md +6 -0
- data/features/command_line/configure.feature +16 -14
- data/features/command_line/example_name_option.feature +3 -3
- data/features/command_line/format_option.feature +73 -0
- data/features/command_line/line_number_appended_to_path.feature +1 -1
- data/features/command_line/line_number_option.feature +2 -2
- data/features/command_line/tag.feature +7 -7
- data/features/configuration/read_options_from_file.feature +29 -16
- data/features/hooks/before_and_after_hooks.feature +9 -14
- data/features/hooks/filtering.feature +174 -0
- data/features/step_definitions/additional_cli_steps.rb +4 -0
- data/features/subject/attribute_of_subject.feature +68 -18
- data/lib/rspec/core/command_line_configuration.rb +16 -16
- data/lib/rspec/core/configuration.rb +14 -15
- data/lib/rspec/core/configuration_options.rb +46 -22
- data/lib/rspec/core/example.rb +16 -6
- data/lib/rspec/core/example_group.rb +11 -11
- data/lib/rspec/core/formatters/base_text_formatter.rb +2 -1
- data/lib/rspec/core/hooks.rb +8 -8
- data/lib/rspec/core/option_parser.rb +13 -3
- data/lib/rspec/core/pending.rb +2 -0
- data/lib/rspec/core/rake_task.rb +1 -1
- data/lib/rspec/core/subject.rb +2 -0
- data/lib/rspec/core/version.rb +1 -1
- data/lib/rspec/core/world.rb +2 -2
- data/spec/rspec/core/configuration_options_spec.rb +147 -151
- data/spec/rspec/core/configuration_spec.rb +67 -19
- data/spec/rspec/core/example_spec.rb +12 -10
- data/spec/rspec/core/formatters/base_text_formatter_spec.rb +25 -1
- data/spec/rspec/core/formatters/html_formatted-1.8.6.html +5 -5
- data/spec/rspec/core/formatters/html_formatted-1.8.7-jruby.html +37 -24
- data/spec/rspec/core/formatters/html_formatted-1.8.7.html +5 -5
- data/spec/rspec/core/formatters/html_formatted-1.9.1.html +5 -5
- data/spec/rspec/core/formatters/html_formatted-1.9.2.html +5 -5
- data/spec/rspec/core/formatters/html_formatter_spec.rb +7 -7
- data/spec/rspec/core/formatters/text_mate_formatted-1.8.6.html +19 -19
- data/spec/rspec/core/formatters/text_mate_formatted-1.8.7-jruby.html +51 -33
- data/spec/rspec/core/formatters/text_mate_formatted-1.8.7.html +19 -19
- data/spec/rspec/core/formatters/text_mate_formatted-1.9.1.html +26 -26
- data/spec/rspec/core/formatters/text_mate_formatted-1.9.2.html +26 -26
- data/spec/rspec/core/formatters/text_mate_formatter_spec.rb +7 -7
- data/spec/rspec/core/hooks_filtering_spec.rb +54 -0
- data/spec/rspec/core/option_parser_spec.rb +53 -17
- data/spec/rspec/core/rake_task_spec.rb +21 -0
- data/spec/spec_helper.rb +1 -1
- metadata +14 -8
@@ -184,7 +184,7 @@ a {
|
|
184
184
|
<dt id="example_group_1">pending spec with no implementation</dt>
|
185
185
|
<script type="text/javascript">makeYellow('rspec-header');</script>
|
186
186
|
<script type="text/javascript">makeYellow('example_group_1');</script>
|
187
|
-
<script type="text/javascript">moveProgressBar('
|
187
|
+
<script type="text/javascript">moveProgressBar('14.2');</script>
|
188
188
|
<dd class="spec not_implemented"><span class="not_implemented_spec_name">is pending (PENDING: Not Yet Implemented)</span></dd>
|
189
189
|
</dl>
|
190
190
|
</div>
|
@@ -198,7 +198,7 @@ a {
|
|
198
198
|
<dt id="example_group_3">with content that would fail</dt>
|
199
199
|
<script type="text/javascript">makeYellow('rspec-header');</script>
|
200
200
|
<script type="text/javascript">makeYellow('example_group_3');</script>
|
201
|
-
<script type="text/javascript">moveProgressBar('
|
201
|
+
<script type="text/javascript">moveProgressBar('28.5');</script>
|
202
202
|
<dd class="spec not_implemented"><span class="not_implemented_spec_name">is pending (PENDING: No reason given)</span></dd>
|
203
203
|
</dl>
|
204
204
|
</div>
|
@@ -207,27 +207,24 @@ a {
|
|
207
207
|
<dt id="example_group_4">with content that would pass</dt>
|
208
208
|
<script type="text/javascript">makeRed('rspec-header');</script>
|
209
209
|
<script type="text/javascript">makeRed('example_group_4');</script>
|
210
|
-
<script type="text/javascript">moveProgressBar('
|
210
|
+
<script type="text/javascript">moveProgressBar('42.8');</script>
|
211
211
|
<dd class="spec pending_fixed">
|
212
212
|
<span class="failed_spec_name">fails</span>
|
213
213
|
<div class="failure" id="failure_0">
|
214
214
|
<div class="message"><pre>RSpec::Core::PendingExampleFixedError</pre></div>
|
215
|
-
<div class="backtrace"><pre
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
<span class="linenum">
|
228
|
-
<span class="offending"><span class="linenum">13</span> <span class="keyword">raise</span> <span class="constant">RSpec</span><span class="punct">::</span><span class="constant">Core</span><span class="punct">::</span><span class="constant">PendingExampleFixedError</span><span class="punct">.</span><span class="ident">new</span> <span class="keyword">if</span> <span class="ident">result</span></span>
|
229
|
-
<span class="linenum">14</span> <span class="keyword">end</span>
|
230
|
-
<span class="linenum">15</span> <span class="ident">throw</span> <span class="symbol">:pending_declared_in_example</span><span class="punct">,</span> <span class="ident">message</span></code></pre>
|
215
|
+
<div class="backtrace"><pre><a href="txmt://open?url=file:///Users/david/projects/ruby/rspec2/repos/rspec-core/spec/rspec/core/resources/formatter_specs.rb&line=18">./spec/rspec/core/resources/formatter_specs.rb:18</a>
|
216
|
+
<a href="txmt://open?url=file:///Users/david/projects/ruby/rspec2/repos/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&line=24">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:24</a>
|
217
|
+
<a href="txmt://open?url=file:///Users/david/projects/ruby/rspec2/repos/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&line=47">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:47</a>
|
218
|
+
<a href="txmt://open?url=file:///Users/david/projects/ruby/rspec2/repos/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&line=47">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:47</a> :in `open'
|
219
|
+
<a href="txmt://open?url=file:///Users/david/projects/ruby/rspec2/repos/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&line=47">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:47</a>
|
220
|
+
<a href="txmt://open?url=file:///Users/david/projects/ruby/rspec2/repos/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&line=46">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:46</a> :in `chdir'
|
221
|
+
<a href="txmt://open?url=file:///Users/david/projects/ruby/rspec2/repos/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&line=46">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:46</a>
|
222
|
+
:1</pre></div>
|
223
|
+
<pre class="ruby"><code><span class="linenum">22</span> <span class="keyword">rescue</span> <span class="constant">Exception</span> <span class="punct">=></span> <span class="ident">e</span>
|
224
|
+
<span class="linenum">23</span> <span class="keyword">end</span>
|
225
|
+
<span class="offending"><span class="linenum">24</span> <span class="keyword">raise</span> <span class="constant">RSpec</span><span class="punct">::</span><span class="constant">Core</span><span class="punct">::</span><span class="constant">PendingExampleFixedError</span><span class="punct">.</span><span class="ident">new</span> <span class="keyword">if</span> <span class="ident">result</span></span>
|
226
|
+
<span class="linenum">25</span> <span class="keyword">end</span>
|
227
|
+
<span class="linenum">26</span> <span class="ident">throw</span> <span class="symbol">:pending_declared_in_example</span><span class="punct">,</span> <span class="ident">message</span></code></pre>
|
231
228
|
</div>
|
232
229
|
</dd>
|
233
230
|
</dl>
|
@@ -235,7 +232,7 @@ a {
|
|
235
232
|
<div class="example_group">
|
236
233
|
<dl style="margin-left: 0px;">
|
237
234
|
<dt id="example_group_5">passing spec</dt>
|
238
|
-
<script type="text/javascript">moveProgressBar('
|
235
|
+
<script type="text/javascript">moveProgressBar('57.1');</script>
|
239
236
|
<dd class="spec passed"><span class="passed_spec_name">passes</span></dd>
|
240
237
|
</dl>
|
241
238
|
</div>
|
@@ -243,7 +240,7 @@ a {
|
|
243
240
|
<dl style="margin-left: 0px;">
|
244
241
|
<dt id="example_group_6">failing spec</dt>
|
245
242
|
<script type="text/javascript">makeRed('example_group_6');</script>
|
246
|
-
<script type="text/javascript">moveProgressBar('
|
243
|
+
<script type="text/javascript">moveProgressBar('71.4');</script>
|
247
244
|
<dd class="spec failed">
|
248
245
|
<span class="failed_spec_name">fails</span>
|
249
246
|
<div class="failure" id="failure_0">
|
@@ -253,17 +250,14 @@ expected 2
|
|
253
250
|
|
254
251
|
(compared using ==)
|
255
252
|
</pre></div>
|
256
|
-
<div class="backtrace"><pre
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
/Users/dchelimsky/projects/ruby/rspec2/repos/rspec-core/spec/spec_helper.rb:44:in `instance_eval'
|
265
|
-
/Users/dchelimsky/projects/ruby/rspec2/repos/rspec-core/spec/spec_helper.rb:44:in `sandboxed'
|
266
|
-
/Users/dchelimsky/projects/ruby/rspec2/repos/rspec-core/spec/spec_helper.rb:70</pre></div>
|
253
|
+
<div class="backtrace"><pre><a href="txmt://open?url=file:///Users/david/projects/ruby/rspec2/repos/rspec-core/spec/rspec/core/resources/formatter_specs.rb&line=33">./spec/rspec/core/resources/formatter_specs.rb:33</a>
|
254
|
+
<a href="txmt://open?url=file:///Users/david/projects/ruby/rspec2/repos/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&line=24">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:24</a>
|
255
|
+
<a href="txmt://open?url=file:///Users/david/projects/ruby/rspec2/repos/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&line=47">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:47</a>
|
256
|
+
<a href="txmt://open?url=file:///Users/david/projects/ruby/rspec2/repos/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&line=47">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:47</a> :in `open'
|
257
|
+
<a href="txmt://open?url=file:///Users/david/projects/ruby/rspec2/repos/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&line=47">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:47</a>
|
258
|
+
<a href="txmt://open?url=file:///Users/david/projects/ruby/rspec2/repos/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&line=46">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:46</a> :in `chdir'
|
259
|
+
<a href="txmt://open?url=file:///Users/david/projects/ruby/rspec2/repos/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&line=46">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:46</a>
|
260
|
+
:1</pre></div>
|
267
261
|
<pre class="ruby"><code><span class="linenum">27</span> <span class="keyword">end</span>
|
268
262
|
<span class="linenum">28</span>
|
269
263
|
<span class="offending"><span class="linenum">29</span> <span class="keyword">raise</span><span class="punct">(</span><span class="constant">RSpec</span><span class="punct">::</span><span class="constant">Expectations</span><span class="punct">::</span><span class="constant">ExpectationNotMetError</span><span class="punct">.</span><span class="ident">new</span><span class="punct">(</span><span class="ident">message</span><span class="punct">))</span></span>
|
@@ -272,8 +266,32 @@ expected 2
|
|
272
266
|
</dd>
|
273
267
|
</dl>
|
274
268
|
</div>
|
269
|
+
<div class="example_group">
|
270
|
+
<dl style="margin-left: 0px;">
|
271
|
+
<dt id="example_group_7">a failing spec with odd backtraces</dt>
|
272
|
+
<script type="text/javascript">makeRed('example_group_7');</script>
|
273
|
+
<script type="text/javascript">moveProgressBar('85.7');</script>
|
274
|
+
<dd class="spec failed">
|
275
|
+
<span class="failed_spec_name">fails with a backtrace that has no file</span>
|
276
|
+
<div class="failure" id="failure_0">
|
277
|
+
<div class="message"><pre>foo</pre></div>
|
278
|
+
<div class="backtrace"><pre>(erb):1</pre></div>
|
279
|
+
<pre class="ruby"><code><span class="linenum">-1</span><span class="comment"># Couldn't get snippet for (erb)</span></code></pre>
|
280
|
+
</div>
|
281
|
+
</dd>
|
282
|
+
<script type="text/javascript">moveProgressBar('100.0');</script>
|
283
|
+
<dd class="spec failed">
|
284
|
+
<span class="failed_spec_name">fails with a backtrace containing an erb file</span>
|
285
|
+
<div class="failure" id="failure_0">
|
286
|
+
<div class="message"><pre>#<Class:01x101751></pre></div>
|
287
|
+
<div class="backtrace"><pre><a href="txmt://open?url=file:///foo.html.erb&line=1">/foo.html.erb:1</a> :in `<main>': foo (RuntimeError)</pre></div>
|
288
|
+
<pre class="ruby"><code><span class="linenum">-1</span><span class="comment"># Couldn't get snippet for /foo.html.erb</span></code></pre>
|
289
|
+
</div>
|
290
|
+
</dd>
|
291
|
+
</dl>
|
292
|
+
</div>
|
275
293
|
<script type="text/javascript">document.getElementById('duration').innerHTML = "Finished in <strong>x seconds</strong>";</script>
|
276
|
-
<script type="text/javascript">document.getElementById('totals').innerHTML = "
|
294
|
+
<script type="text/javascript">document.getElementById('totals').innerHTML = "7 examples, 4 failures, 2 pending";</script>
|
277
295
|
</div>
|
278
296
|
</div>
|
279
297
|
</body>
|
@@ -212,18 +212,18 @@ a {
|
|
212
212
|
<span class="failed_spec_name">fails</span>
|
213
213
|
<div class="failure" id="failure_0">
|
214
214
|
<div class="message"><pre>RSpec::Core::PendingExampleFixedError</pre></div>
|
215
|
-
<div class="backtrace"><pre><a href="txmt://open?url=file:///Users/
|
216
|
-
<a href="txmt://open?url=file:///Users/
|
217
|
-
<a href="txmt://open?url=file:///Users/
|
218
|
-
<a href="txmt://open?url=file:///Users/
|
219
|
-
<a href="txmt://open?url=file:///Users/
|
220
|
-
<a href="txmt://open?url=file:///Users/
|
221
|
-
<a href="txmt://open?url=file:///Users/
|
222
|
-
<pre class="ruby"><code><span class="linenum">
|
223
|
-
<span class="linenum">
|
224
|
-
<span class="offending"><span class="linenum">
|
225
|
-
<span class="linenum">
|
226
|
-
<span class="linenum">
|
215
|
+
<div class="backtrace"><pre><a href="txmt://open?url=file:///Users/david/projects/ruby/rspec2/repos/rspec-core/spec/rspec/core/resources/formatter_specs.rb&line=18">./spec/rspec/core/resources/formatter_specs.rb:18</a>
|
216
|
+
<a href="txmt://open?url=file:///Users/david/projects/ruby/rspec2/repos/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&line=24">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:24</a>
|
217
|
+
<a href="txmt://open?url=file:///Users/david/projects/ruby/rspec2/repos/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&line=47">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:47</a>
|
218
|
+
<a href="txmt://open?url=file:///Users/david/projects/ruby/rspec2/repos/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&line=47">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:47</a> :in `open'
|
219
|
+
<a href="txmt://open?url=file:///Users/david/projects/ruby/rspec2/repos/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&line=47">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:47</a>
|
220
|
+
<a href="txmt://open?url=file:///Users/david/projects/ruby/rspec2/repos/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&line=46">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:46</a> :in `chdir'
|
221
|
+
<a href="txmt://open?url=file:///Users/david/projects/ruby/rspec2/repos/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&line=46">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:46</a> </pre></div>
|
222
|
+
<pre class="ruby"><code><span class="linenum">22</span> <span class="keyword">rescue</span> <span class="constant">Exception</span> <span class="punct">=></span> <span class="ident">e</span>
|
223
|
+
<span class="linenum">23</span> <span class="keyword">end</span>
|
224
|
+
<span class="offending"><span class="linenum">24</span> <span class="keyword">raise</span> <span class="constant">RSpec</span><span class="punct">::</span><span class="constant">Core</span><span class="punct">::</span><span class="constant">PendingExampleFixedError</span><span class="punct">.</span><span class="ident">new</span> <span class="keyword">if</span> <span class="ident">result</span></span>
|
225
|
+
<span class="linenum">25</span> <span class="keyword">end</span>
|
226
|
+
<span class="linenum">26</span> <span class="ident">throw</span> <span class="symbol">:pending_declared_in_example</span><span class="punct">,</span> <span class="ident">message</span></code></pre>
|
227
227
|
</div>
|
228
228
|
</dd>
|
229
229
|
</dl>
|
@@ -249,13 +249,13 @@ expected 2
|
|
249
249
|
|
250
250
|
(compared using ==)
|
251
251
|
</pre></div>
|
252
|
-
<div class="backtrace"><pre><a href="txmt://open?url=file:///Users/
|
253
|
-
<a href="txmt://open?url=file:///Users/
|
254
|
-
<a href="txmt://open?url=file:///Users/
|
255
|
-
<a href="txmt://open?url=file:///Users/
|
256
|
-
<a href="txmt://open?url=file:///Users/
|
257
|
-
<a href="txmt://open?url=file:///Users/
|
258
|
-
<a href="txmt://open?url=file:///Users/
|
252
|
+
<div class="backtrace"><pre><a href="txmt://open?url=file:///Users/david/projects/ruby/rspec2/repos/rspec-core/spec/rspec/core/resources/formatter_specs.rb&line=33">./spec/rspec/core/resources/formatter_specs.rb:33</a>
|
253
|
+
<a href="txmt://open?url=file:///Users/david/projects/ruby/rspec2/repos/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&line=24">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:24</a>
|
254
|
+
<a href="txmt://open?url=file:///Users/david/projects/ruby/rspec2/repos/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&line=47">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:47</a>
|
255
|
+
<a href="txmt://open?url=file:///Users/david/projects/ruby/rspec2/repos/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&line=47">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:47</a> :in `open'
|
256
|
+
<a href="txmt://open?url=file:///Users/david/projects/ruby/rspec2/repos/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&line=47">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:47</a>
|
257
|
+
<a href="txmt://open?url=file:///Users/david/projects/ruby/rspec2/repos/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&line=46">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:46</a> :in `chdir'
|
258
|
+
<a href="txmt://open?url=file:///Users/david/projects/ruby/rspec2/repos/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&line=46">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:46</a> </pre></div>
|
259
259
|
<pre class="ruby"><code><span class="linenum">27</span> <span class="keyword">end</span>
|
260
260
|
<span class="linenum">28</span>
|
261
261
|
<span class="offending"><span class="linenum">29</span> <span class="keyword">raise</span><span class="punct">(</span><span class="constant">RSpec</span><span class="punct">::</span><span class="constant">Expectations</span><span class="punct">::</span><span class="constant">ExpectationNotMetError</span><span class="punct">.</span><span class="ident">new</span><span class="punct">(</span><span class="ident">message</span><span class="punct">))</span></span>
|
@@ -212,18 +212,18 @@ a {
|
|
212
212
|
<span class="failed_spec_name">fails</span>
|
213
213
|
<div class="failure" id="failure_0">
|
214
214
|
<div class="message"><pre>RSpec::Core::PendingExampleFixedError</pre></div>
|
215
|
-
<div class="backtrace"><pre><a href="txmt://open?url=file:///Users/
|
216
|
-
<a href="txmt://open?url=file:///Users/
|
217
|
-
<a href="txmt://open?url=file:///Users/
|
218
|
-
<a href="txmt://open?url=file:///Users/
|
219
|
-
<a href="txmt://open?url=file:///Users/
|
220
|
-
<a href="txmt://open?url=file:///Users/
|
221
|
-
<a href="txmt://open?url=file:///Users/
|
222
|
-
<pre class="ruby"><code><span class="linenum">
|
223
|
-
<span class="linenum">
|
224
|
-
<span class="offending"><span class="linenum">
|
225
|
-
<span class="linenum">
|
226
|
-
<span class="linenum">
|
215
|
+
<div class="backtrace"><pre><a href="txmt://open?url=file:///Users/david/projects/ruby/rspec2/repos/rspec-core/spec/rspec/core/resources/formatter_specs.rb&line=18">./spec/rspec/core/resources/formatter_specs.rb:18</a> :in `block (3 levels) in <top (required)>'
|
216
|
+
<a href="txmt://open?url=file:///Users/david/projects/ruby/rspec2/repos/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&line=24">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:24</a> :in `block (2 levels) in <module:Formatters>'
|
217
|
+
<a href="txmt://open?url=file:///Users/david/projects/ruby/rspec2/repos/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&line=47">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:47</a> :in `block (5 levels) in <module:Formatters>'
|
218
|
+
<a href="txmt://open?url=file:///Users/david/projects/ruby/rspec2/repos/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&line=47">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:47</a> :in `open'
|
219
|
+
<a href="txmt://open?url=file:///Users/david/projects/ruby/rspec2/repos/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&line=47">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:47</a> :in `block (4 levels) in <module:Formatters>'
|
220
|
+
<a href="txmt://open?url=file:///Users/david/projects/ruby/rspec2/repos/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&line=46">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:46</a> :in `chdir'
|
221
|
+
<a href="txmt://open?url=file:///Users/david/projects/ruby/rspec2/repos/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&line=46">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:46</a> :in `block (3 levels) in <module:Formatters>'</pre></div>
|
222
|
+
<pre class="ruby"><code><span class="linenum">22</span> <span class="keyword">rescue</span> <span class="constant">Exception</span> <span class="punct">=></span> <span class="ident">e</span>
|
223
|
+
<span class="linenum">23</span> <span class="keyword">end</span>
|
224
|
+
<span class="offending"><span class="linenum">24</span> <span class="keyword">raise</span> <span class="constant">RSpec</span><span class="punct">::</span><span class="constant">Core</span><span class="punct">::</span><span class="constant">PendingExampleFixedError</span><span class="punct">.</span><span class="ident">new</span> <span class="keyword">if</span> <span class="ident">result</span></span>
|
225
|
+
<span class="linenum">25</span> <span class="keyword">end</span>
|
226
|
+
<span class="linenum">26</span> <span class="ident">throw</span> <span class="symbol">:pending_declared_in_example</span><span class="punct">,</span> <span class="ident">message</span></code></pre>
|
227
227
|
</div>
|
228
228
|
</dd>
|
229
229
|
</dl>
|
@@ -249,13 +249,13 @@ expected 2
|
|
249
249
|
|
250
250
|
(compared using ==)
|
251
251
|
</pre></div>
|
252
|
-
<div class="backtrace"><pre><a href="txmt://open?url=file:///Users/
|
253
|
-
<a href="txmt://open?url=file:///Users/
|
254
|
-
<a href="txmt://open?url=file:///Users/
|
255
|
-
<a href="txmt://open?url=file:///Users/
|
256
|
-
<a href="txmt://open?url=file:///Users/
|
257
|
-
<a href="txmt://open?url=file:///Users/
|
258
|
-
<a href="txmt://open?url=file:///Users/
|
252
|
+
<div class="backtrace"><pre><a href="txmt://open?url=file:///Users/david/projects/ruby/rspec2/repos/rspec-core/spec/rspec/core/resources/formatter_specs.rb&line=33">./spec/rspec/core/resources/formatter_specs.rb:33</a> :in `block (2 levels) in <top (required)>'
|
253
|
+
<a href="txmt://open?url=file:///Users/david/projects/ruby/rspec2/repos/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&line=24">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:24</a> :in `block (2 levels) in <module:Formatters>'
|
254
|
+
<a href="txmt://open?url=file:///Users/david/projects/ruby/rspec2/repos/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&line=47">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:47</a> :in `block (5 levels) in <module:Formatters>'
|
255
|
+
<a href="txmt://open?url=file:///Users/david/projects/ruby/rspec2/repos/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&line=47">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:47</a> :in `open'
|
256
|
+
<a href="txmt://open?url=file:///Users/david/projects/ruby/rspec2/repos/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&line=47">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:47</a> :in `block (4 levels) in <module:Formatters>'
|
257
|
+
<a href="txmt://open?url=file:///Users/david/projects/ruby/rspec2/repos/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&line=46">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:46</a> :in `chdir'
|
258
|
+
<a href="txmt://open?url=file:///Users/david/projects/ruby/rspec2/repos/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&line=46">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:46</a> :in `block (3 levels) in <module:Formatters>'</pre></div>
|
259
259
|
<pre class="ruby"><code><span class="linenum">27</span> <span class="keyword">end</span>
|
260
260
|
<span class="linenum">28</span>
|
261
261
|
<span class="offending"><span class="linenum">29</span> <span class="keyword">raise</span><span class="punct">(</span><span class="constant">RSpec</span><span class="punct">::</span><span class="constant">Expectations</span><span class="punct">::</span><span class="constant">ExpectationNotMetError</span><span class="punct">.</span><span class="ident">new</span><span class="punct">(</span><span class="ident">message</span><span class="punct">))</span></span>
|
@@ -274,13 +274,13 @@ expected 2
|
|
274
274
|
<div class="failure" id="failure_0">
|
275
275
|
<div class="message"><pre>foo</pre></div>
|
276
276
|
<div class="backtrace"><pre>(erb):1:in `<main>'
|
277
|
-
<a href="txmt://open?url=file:///Users/
|
278
|
-
<a href="txmt://open?url=file:///Users/
|
279
|
-
<a href="txmt://open?url=file:///Users/
|
280
|
-
<a href="txmt://open?url=file:///Users/
|
281
|
-
<a href="txmt://open?url=file:///Users/
|
282
|
-
<a href="txmt://open?url=file:///Users/
|
283
|
-
<a href="txmt://open?url=file:///Users/
|
277
|
+
<a href="txmt://open?url=file:///Users/david/projects/ruby/rspec2/repos/rspec-core/spec/rspec/core/resources/formatter_specs.rb&line=41">./spec/rspec/core/resources/formatter_specs.rb:41</a> :in `block (2 levels) in <top (required)>'
|
278
|
+
<a href="txmt://open?url=file:///Users/david/projects/ruby/rspec2/repos/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&line=24">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:24</a> :in `block (2 levels) in <module:Formatters>'
|
279
|
+
<a href="txmt://open?url=file:///Users/david/projects/ruby/rspec2/repos/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&line=47">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:47</a> :in `block (5 levels) in <module:Formatters>'
|
280
|
+
<a href="txmt://open?url=file:///Users/david/projects/ruby/rspec2/repos/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&line=47">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:47</a> :in `open'
|
281
|
+
<a href="txmt://open?url=file:///Users/david/projects/ruby/rspec2/repos/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&line=47">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:47</a> :in `block (4 levels) in <module:Formatters>'
|
282
|
+
<a href="txmt://open?url=file:///Users/david/projects/ruby/rspec2/repos/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&line=46">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:46</a> :in `chdir'
|
283
|
+
<a href="txmt://open?url=file:///Users/david/projects/ruby/rspec2/repos/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&line=46">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:46</a> :in `block (3 levels) in <module:Formatters>'</pre></div>
|
284
284
|
<pre class="ruby"><code><span class="linenum">-1</span><span class="comment"># Couldn't get snippet for (erb)</span></code></pre>
|
285
285
|
</div>
|
286
286
|
</dd>
|
@@ -212,18 +212,18 @@ a {
|
|
212
212
|
<span class="failed_spec_name">fails</span>
|
213
213
|
<div class="failure" id="failure_0">
|
214
214
|
<div class="message"><pre>RSpec::Core::PendingExampleFixedError</pre></div>
|
215
|
-
<div class="backtrace"><pre><a href="txmt://open?url=file:///Users/
|
216
|
-
<a href="txmt://open?url=file:///Users/
|
217
|
-
<a href="txmt://open?url=file:///Users/
|
218
|
-
<a href="txmt://open?url=file:///Users/
|
219
|
-
<a href="txmt://open?url=file:///Users/
|
220
|
-
<a href="txmt://open?url=file:///Users/
|
221
|
-
<a href="txmt://open?url=file:///Users/
|
222
|
-
<pre class="ruby"><code><span class="linenum">
|
223
|
-
<span class="linenum">
|
224
|
-
<span class="offending"><span class="linenum">
|
225
|
-
<span class="linenum">
|
226
|
-
<span class="linenum">
|
215
|
+
<div class="backtrace"><pre><a href="txmt://open?url=file:///Users/david/projects/ruby/rspec2/repos/rspec-core/spec/rspec/core/resources/formatter_specs.rb&line=18">./spec/rspec/core/resources/formatter_specs.rb:18</a> :in `block (3 levels) in <top (required)>'
|
216
|
+
<a href="txmt://open?url=file:///Users/david/projects/ruby/rspec2/repos/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&line=24">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:24</a> :in `block (2 levels) in <module:Formatters>'
|
217
|
+
<a href="txmt://open?url=file:///Users/david/projects/ruby/rspec2/repos/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&line=47">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:47</a> :in `block (5 levels) in <module:Formatters>'
|
218
|
+
<a href="txmt://open?url=file:///Users/david/projects/ruby/rspec2/repos/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&line=47">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:47</a> :in `open'
|
219
|
+
<a href="txmt://open?url=file:///Users/david/projects/ruby/rspec2/repos/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&line=47">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:47</a> :in `block (4 levels) in <module:Formatters>'
|
220
|
+
<a href="txmt://open?url=file:///Users/david/projects/ruby/rspec2/repos/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&line=46">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:46</a> :in `chdir'
|
221
|
+
<a href="txmt://open?url=file:///Users/david/projects/ruby/rspec2/repos/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&line=46">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:46</a> :in `block (3 levels) in <module:Formatters>'</pre></div>
|
222
|
+
<pre class="ruby"><code><span class="linenum">22</span> <span class="keyword">rescue</span> <span class="constant">Exception</span> <span class="punct">=></span> <span class="ident">e</span>
|
223
|
+
<span class="linenum">23</span> <span class="keyword">end</span>
|
224
|
+
<span class="offending"><span class="linenum">24</span> <span class="keyword">raise</span> <span class="constant">RSpec</span><span class="punct">::</span><span class="constant">Core</span><span class="punct">::</span><span class="constant">PendingExampleFixedError</span><span class="punct">.</span><span class="ident">new</span> <span class="keyword">if</span> <span class="ident">result</span></span>
|
225
|
+
<span class="linenum">25</span> <span class="keyword">end</span>
|
226
|
+
<span class="linenum">26</span> <span class="ident">throw</span> <span class="symbol">:pending_declared_in_example</span><span class="punct">,</span> <span class="ident">message</span></code></pre>
|
227
227
|
</div>
|
228
228
|
</dd>
|
229
229
|
</dl>
|
@@ -249,13 +249,13 @@ expected 2
|
|
249
249
|
|
250
250
|
(compared using ==)
|
251
251
|
</pre></div>
|
252
|
-
<div class="backtrace"><pre><a href="txmt://open?url=file:///Users/
|
253
|
-
<a href="txmt://open?url=file:///Users/
|
254
|
-
<a href="txmt://open?url=file:///Users/
|
255
|
-
<a href="txmt://open?url=file:///Users/
|
256
|
-
<a href="txmt://open?url=file:///Users/
|
257
|
-
<a href="txmt://open?url=file:///Users/
|
258
|
-
<a href="txmt://open?url=file:///Users/
|
252
|
+
<div class="backtrace"><pre><a href="txmt://open?url=file:///Users/david/projects/ruby/rspec2/repos/rspec-core/spec/rspec/core/resources/formatter_specs.rb&line=33">./spec/rspec/core/resources/formatter_specs.rb:33</a> :in `block (2 levels) in <top (required)>'
|
253
|
+
<a href="txmt://open?url=file:///Users/david/projects/ruby/rspec2/repos/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&line=24">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:24</a> :in `block (2 levels) in <module:Formatters>'
|
254
|
+
<a href="txmt://open?url=file:///Users/david/projects/ruby/rspec2/repos/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&line=47">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:47</a> :in `block (5 levels) in <module:Formatters>'
|
255
|
+
<a href="txmt://open?url=file:///Users/david/projects/ruby/rspec2/repos/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&line=47">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:47</a> :in `open'
|
256
|
+
<a href="txmt://open?url=file:///Users/david/projects/ruby/rspec2/repos/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&line=47">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:47</a> :in `block (4 levels) in <module:Formatters>'
|
257
|
+
<a href="txmt://open?url=file:///Users/david/projects/ruby/rspec2/repos/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&line=46">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:46</a> :in `chdir'
|
258
|
+
<a href="txmt://open?url=file:///Users/david/projects/ruby/rspec2/repos/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&line=46">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:46</a> :in `block (3 levels) in <module:Formatters>'</pre></div>
|
259
259
|
<pre class="ruby"><code><span class="linenum">27</span> <span class="keyword">end</span>
|
260
260
|
<span class="linenum">28</span>
|
261
261
|
<span class="offending"><span class="linenum">29</span> <span class="keyword">raise</span><span class="punct">(</span><span class="constant">RSpec</span><span class="punct">::</span><span class="constant">Expectations</span><span class="punct">::</span><span class="constant">ExpectationNotMetError</span><span class="punct">.</span><span class="ident">new</span><span class="punct">(</span><span class="ident">message</span><span class="punct">))</span></span>
|
@@ -274,13 +274,13 @@ expected 2
|
|
274
274
|
<div class="failure" id="failure_0">
|
275
275
|
<div class="message"><pre>foo</pre></div>
|
276
276
|
<div class="backtrace"><pre>(erb):1:in `<main>'
|
277
|
-
<a href="txmt://open?url=file:///Users/
|
278
|
-
<a href="txmt://open?url=file:///Users/
|
279
|
-
<a href="txmt://open?url=file:///Users/
|
280
|
-
<a href="txmt://open?url=file:///Users/
|
281
|
-
<a href="txmt://open?url=file:///Users/
|
282
|
-
<a href="txmt://open?url=file:///Users/
|
283
|
-
<a href="txmt://open?url=file:///Users/
|
277
|
+
<a href="txmt://open?url=file:///Users/david/projects/ruby/rspec2/repos/rspec-core/spec/rspec/core/resources/formatter_specs.rb&line=41">./spec/rspec/core/resources/formatter_specs.rb:41</a> :in `block (2 levels) in <top (required)>'
|
278
|
+
<a href="txmt://open?url=file:///Users/david/projects/ruby/rspec2/repos/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&line=24">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:24</a> :in `block (2 levels) in <module:Formatters>'
|
279
|
+
<a href="txmt://open?url=file:///Users/david/projects/ruby/rspec2/repos/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&line=47">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:47</a> :in `block (5 levels) in <module:Formatters>'
|
280
|
+
<a href="txmt://open?url=file:///Users/david/projects/ruby/rspec2/repos/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&line=47">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:47</a> :in `open'
|
281
|
+
<a href="txmt://open?url=file:///Users/david/projects/ruby/rspec2/repos/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&line=47">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:47</a> :in `block (4 levels) in <module:Formatters>'
|
282
|
+
<a href="txmt://open?url=file:///Users/david/projects/ruby/rspec2/repos/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&line=46">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:46</a> :in `chdir'
|
283
|
+
<a href="txmt://open?url=file:///Users/david/projects/ruby/rspec2/repos/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&line=46">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:46</a> :in `block (3 levels) in <module:Formatters>'</pre></div>
|
284
284
|
<pre class="ruby"><code><span class="linenum">-1</span><span class="comment"># Couldn't get snippet for (erb)</span></code></pre>
|
285
285
|
</div>
|
286
286
|
</dd>
|
@@ -41,13 +41,13 @@ module RSpec
|
|
41
41
|
|
42
42
|
# Uncomment this group temporarily in order to overwrite the expected
|
43
43
|
# with actual. Use with care!!!
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
44
|
+
describe "file generator", :if => ENV['GENERATE'] do
|
45
|
+
it "generates a new comparison file" do
|
46
|
+
Dir.chdir(root) do
|
47
|
+
File.open(expected_file, 'w') {|io| io.write(generated_html)}
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
51
|
|
52
52
|
it "produces HTML identical to the one we designed manually" do
|
53
53
|
Dir.chdir(root) do
|
@@ -81,6 +81,60 @@ module RSpec::Core
|
|
81
81
|
group.run
|
82
82
|
filters.should == []
|
83
83
|
end
|
84
|
+
|
85
|
+
context "when the hook filters apply to individual examples instead of example groups" do
|
86
|
+
let(:each_filters) { [] }
|
87
|
+
let(:all_filters) { [] }
|
88
|
+
|
89
|
+
let(:group) do
|
90
|
+
md = example_metadata
|
91
|
+
ExampleGroup.describe do
|
92
|
+
it("example", md) { }
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
96
|
+
def filters
|
97
|
+
each_filters + all_filters
|
98
|
+
end
|
99
|
+
|
100
|
+
before(:each) do
|
101
|
+
af, ef = all_filters, each_filters
|
102
|
+
|
103
|
+
RSpec.configure do |c|
|
104
|
+
c.before(:all, :foo => :bar) { af << "before all in config"}
|
105
|
+
c.around(:each, :foo => :bar) {|example| ef << "around each in config"; example.run}
|
106
|
+
c.before(:each, :foo => :bar) { ef << "before each in config"}
|
107
|
+
c.after(:each, :foo => :bar) { ef << "after each in config"}
|
108
|
+
c.after(:all, :foo => :bar) { af << "after all in config"}
|
109
|
+
end
|
110
|
+
|
111
|
+
group.run
|
112
|
+
end
|
113
|
+
|
114
|
+
describe 'an example with matching metadata' do
|
115
|
+
let(:example_metadata) { { :foo => :bar } }
|
116
|
+
|
117
|
+
it "runs the `:each` hooks" do
|
118
|
+
each_filters.should == [
|
119
|
+
'around each in config',
|
120
|
+
'before each in config',
|
121
|
+
'after each in config'
|
122
|
+
]
|
123
|
+
end
|
124
|
+
|
125
|
+
it "does not run the `:all` hooks" do
|
126
|
+
all_filters.should be_empty
|
127
|
+
end
|
128
|
+
end
|
129
|
+
|
130
|
+
describe 'an example without matching metadata' do
|
131
|
+
let(:example_metadata) { { :foo => :bazz } }
|
132
|
+
|
133
|
+
it "does not run any of the hooks" do
|
134
|
+
filters.should be_empty
|
135
|
+
end
|
136
|
+
end
|
137
|
+
end
|
84
138
|
end
|
85
139
|
|
86
140
|
describe "hooks with multiple filters" do
|
@@ -8,14 +8,8 @@ module RSpec::Core
|
|
8
8
|
|
9
9
|
let(:output_file){ mock File }
|
10
10
|
|
11
|
-
|
12
|
-
|
13
|
-
Parser.parse!(%w[--formatter doc])
|
14
|
-
end
|
15
|
-
|
16
|
-
it "converts --formatter to --format" do
|
17
|
-
options = Parser.parse!(%w[--formatter doc])
|
18
|
-
options.should eq( {:formatter=>"doc"} )
|
11
|
+
before do
|
12
|
+
File.stub(:open).with("foo.txt",'w') { (output_file) }
|
19
13
|
end
|
20
14
|
|
21
15
|
it "does not parse empty args" do
|
@@ -24,16 +18,58 @@ module RSpec::Core
|
|
24
18
|
parser.parse!([])
|
25
19
|
end
|
26
20
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
21
|
+
describe "--formatter" do
|
22
|
+
it "is deprecated" do
|
23
|
+
RSpec.should_receive(:deprecate)
|
24
|
+
Parser.parse!(%w[--formatter doc])
|
25
|
+
end
|
26
|
+
|
27
|
+
it "gets converted to --format" do
|
28
|
+
options = Parser.parse!(%w[--formatter doc])
|
29
|
+
options[:formatters].first.should eq(["doc"])
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
describe "--format" do
|
34
|
+
it "defines the formatter" do
|
35
|
+
options = Parser.parse!(%w[--format doc])
|
36
|
+
options[:formatters].first.should eq(["doc"])
|
37
|
+
end
|
31
38
|
end
|
32
39
|
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
40
|
+
describe "-f" do
|
41
|
+
it "defines the formatter" do
|
42
|
+
options = Parser.parse!(%w[-f doc])
|
43
|
+
options[:formatters].first.should eq(["doc"])
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
%w[--out -o].each do |option|
|
48
|
+
describe option do
|
49
|
+
let(:options) { Parser.parse!([option, 'out.txt']) }
|
50
|
+
|
51
|
+
it "sets the output stream for the formatter" do
|
52
|
+
options[:formatters].last.should eq(['progress', 'out.txt'])
|
53
|
+
end
|
54
|
+
|
55
|
+
context "with multiple formatters" do
|
56
|
+
context "after last formatter" do
|
57
|
+
it "sets the output stream for the last formatter" do
|
58
|
+
options = Parser.parse!(['-f', 'progress', '-f', 'doc', option, 'out.txt'])
|
59
|
+
options[:formatters][0].should eq(['progress'])
|
60
|
+
options[:formatters][1].should eq(['doc', 'out.txt'])
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
context "after first formatter" do
|
65
|
+
it "sets the output stream for the first formatter" do
|
66
|
+
options = Parser.parse!(['-f', 'progress', option, 'out.txt', '-f', 'doc'])
|
67
|
+
options[:formatters][0].should eq(['progress', 'out.txt'])
|
68
|
+
options[:formatters][1].should eq(['doc'])
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
37
73
|
end
|
38
74
|
end
|
39
|
-
end
|
75
|
+
end
|