public
Fork of dchelimsky/rspec-tmbundle
Description: Textmate bundle for RSpec.
Clone URL: git://github.com/timcharper/rspec-tmbundle.git
Better failure messages for a message expectation after a method stub. 
Fixes http://rspec.lighthouseapp.com/projects/5645/tickets/352.
dchelimsky (author)
Sun Mar 30 20:34:43 -0700 2008
commit  e81efef7089d5f1d65c49cc80395e394703e2e75
tree    937355bc835034a32288159cbca204a176d2100c
parent  8ea84aadbc0f805c670e536e51713b9dde5761a1
...
155
156
157
158
 
159
160
161
...
185
186
187
 
 
 
 
 
 
 
 
188
189
 
 
 
 
 
190
191
192
...
155
156
157
 
158
159
160
161
...
185
186
187
188
189
190
191
192
193
194
195
196
 
197
198
199
200
201
202
203
204
0
@@ -155,7 +155,7 @@ module Spec
0
         @sym == sym and not @args_expectation.check_args(args)
0
       end
0
        
0
- def verify_messages_received
0
+ def verify_messages_received
0
         return if expected_messages_received?
0
     
0
         generate_error
0
@@ -185,8 +185,20 @@ module Spec
0
         @expected_received_count == @actual_received_count
0
       end
0
       
0
+ def similar_messages
0
+ @similar_messages ||= []
0
+ end
0
+
0
+ def advise(args, block)
0
+ similar_messages << args
0
+ end
0
+
0
       def generate_error
0
- @error_generator.raise_expectation_error(@sym, @expected_received_count, @actual_received_count, *@args_expectation.args)
0
+ if similar_messages.empty?
0
+ @error_generator.raise_expectation_error(@sym, @expected_received_count, @actual_received_count, *@args_expectation.args)
0
+ else
0
+ @error_generator.raise_unexpected_message_args_error(self, *@similar_messages.first)
0
+ end
0
       end
0
 
0
       def with(*args, &block)
...
64
65
66
67
 
 
 
 
 
 
 
 
 
 
68
69
70
...
64
65
66
 
67
68
69
70
71
72
73
74
75
76
77
78
79
0
@@ -64,7 +64,16 @@ module Spec
0
         if expectation = find_matching_expectation(sym, *args)
0
           expectation.invoke(args, block)
0
         elsif stub = find_matching_method_stub(sym, *args)
0
- stub.invoke([], block)
0
+ if expectation = find_almost_matching_expectation(sym, *args)
0
+ if expectation.expected_messages_received?
0
+ stub.invoke([], block)
0
+ else
0
+ expectation.advise(args, block)
0
+ stub.invoke([], block)
0
+ end
0
+ else
0
+ stub.invoke([], block)
0
+ end
0
         elsif expectation = find_almost_matching_expectation(sym, *args)
0
           raise_unexpected_message_args_error(expectation, *args) unless has_negative_expectation?(sym) unless null_object?
0
         else
...
19
20
21
22
 
23
24
25
...
36
37
38
39
 
40
41
42
...
57
58
59
60
61
 
 
62
63
64
65
66
 
 
 
67
68
69
...
107
108
109
110
111
112
113
114
 
 
115
116
117
...
179
180
181
182
 
183
184
185
...
19
20
21
 
22
23
24
25
...
36
37
38
 
39
40
41
42
...
57
58
59
 
 
60
61
62
63
 
 
 
64
65
66
67
68
69
...
107
108
109
 
 
 
 
 
110
111
112
113
114
...
176
177
178
 
179
180
181
182
0
@@ -19,7 +19,7 @@ module Spec
0
                                                  "Separate multiple patterns with commas.",
0
                                                  "Applies only to directories named on the command line (files",
0
                                                  "named explicitly on the command line will be loaded regardless)."],
0
- :diff => ["-D", "--diff [FORMAT]", "Show diff of objects that are expected to be equal when they are not",
0
+ :diff => ["-D", "--diff [FORMAT]","Show diff of objects that are expected to be equal when they are not",
0
                                              "Builtin formats: unified|u|context|c",
0
                                              "You can also specify a custom differ class",
0
                                              "(in which case you should also specify --require)"],
0
@@ -36,7 +36,7 @@ module Spec
0
         :specification => ["-s", "--specification [NAME]", "DEPRECATED - use -e instead", "(This will be removed when autotest works with -e)"],
0
         :line => ["-l", "--line LINE_NUMBER", Integer, "Execute behaviout or specification at given line.",
0
                                                        "(does not work for dynamically generated specs)"],
0
- :format => ["-f", "--format FORMAT[:WHERE]", "Specifies what format to use for output. Specify WHERE to tell",
0
+ :format => ["-f", "--format FORMAT[:WHERE]","Specifies what format to use for output. Specify WHERE to tell",
0
                                                     "the formatter where to write the output. All built-in formats",
0
                                                     "expect WHERE to be a file name, and will write to STDOUT if it's",
0
                                                     "not specified. The --format option may be specified several times",
0
@@ -57,13 +57,13 @@ module Spec
0
                                                     "FORMAT can also be the name of a custom formatter class",
0
                                                     "(in which case you should also specify --require to load it)"],
0
         :require => ["-r", "--require FILE", "Require FILE before running specs",
0
- "Useful for loading custom formatters or other extensions.",
0
- "If this option is used it must come before the others"],
0
+ "Useful for loading custom formatters or other extensions.",
0
+ "If this option is used it must come before the others"],
0
         :backtrace => ["-b", "--backtrace", "Output full backtrace"],
0
         :loadby => ["-L", "--loadby STRATEGY", "Specify the strategy by which spec files should be loaded.",
0
- "STRATEGY can currently only be 'mtime' (File modification time)",
0
- "By default, spec files are loaded in alphabetical order if --loadby",
0
- "is not specified."],
0
+ "STRATEGY can currently only be 'mtime' (File modification time)",
0
+ "By default, spec files are loaded in alphabetical order if --loadby",
0
+ "is not specified."],
0
         :reverse => ["-R", "--reverse", "Run examples in reverse order"],
0
         :timeout => ["-t", "--timeout FLOAT", "Interrupt and fail each example that doesn't complete in the",
0
                                               "specified time"],
0
@@ -107,11 +107,8 @@ module Spec
0
         on(*OPTIONS[:heckle]) {|heckle| @options.load_heckle_runner(heckle)}
0
         on(*OPTIONS[:dry_run]) {@options.dry_run = true}
0
         on(*OPTIONS[:options_file]) {|options_file| parse_options_file(options_file)}
0
- on(*OPTIONS[:generate_options]) do |options_file|
0
- end
0
- on(*OPTIONS[:runner]) do |runner|
0
- @options.user_input_for_runner = runner
0
- end
0
+ on(*OPTIONS[:generate_options]) {|options_file|}
0
+ on(*OPTIONS[:runner]) {|runner| @options.user_input_for_runner = runner}
0
         on(*OPTIONS[:drb]) {}
0
         on(*OPTIONS[:version]) {parse_version}
0
         on_tail(*OPTIONS[:help]) {parse_help}
0
@@ -179,7 +176,7 @@ module Spec
0
         is_drb = false
0
         is_drb ||= argv.delete(OPTIONS[:drb][0])
0
         is_drb ||= argv.delete(OPTIONS[:drb][1])
0
- return nil unless is_drb
0
+ return false unless is_drb
0
         @options.examples_should_not_be_run
0
         DrbCommandLine.run(
0
           self.class.parse(argv, @error_stream, @out_stream)
...
84
85
86
87
88
89
90
91
92
 
93
94
95
...
84
85
86
 
87
88
89
90
 
91
92
93
94
0
@@ -84,12 +84,11 @@ module Spec
0
       end
0
            
0
       it "should raise exception if args don't match when method called even when the method is stubbed" do
0
- pending("need to do some refactoring before trying to get this to pass")
0
         @mock.stub!(:something)
0
         @mock.should_receive(:something).with("a","b","c")
0
         lambda {
0
           @mock.something("a","d","c")
0
- violated
0
+ @mock.rspec_verify
0
         }.should raise_error(MockExpectationError, "Mock 'test mock' expected :something with (\"a\", \"b\", \"c\") but received it with (\"a\", \"d\", \"c\")")
0
       end
0
            
...
189
190
191
192
193
194
 
 
 
195
196
197
...
205
206
207
208
209
210
 
 
 
211
212
213
...
221
222
223
224
225
226
 
 
 
227
228
229
...
236
237
238
239
240
241
 
 
 
242
243
244
...
266
267
268
269
270
271
 
 
 
272
273
274
...
297
298
299
300
301
302
 
 
 
303
304
305
...
189
190
191
 
 
 
192
193
194
195
196
197
...
205
206
207
 
 
 
208
209
210
211
212
213
...
221
222
223
 
 
 
224
225
226
227
228
229
...
236
237
238
 
 
 
239
240
241
242
243
244
...
266
267
268
 
 
 
269
270
271
272
273
274
...
297
298
299
 
 
 
300
301
302
303
304
305
0
@@ -189,9 +189,9 @@ a {
0
       <div class="failure" id="failure_1">
0
         <div class="message"><pre>Mock 'poke me' expected :poke with (any args) once, but received it 0 times</pre></div>
0
         <div class="backtrace"><pre>./failing_examples/mocking_example.rb:13:
0
-./spec/spec/runner/formatter/html_formatter_spec.rb:25:
0
-./spec/spec/runner/formatter/html_formatter_spec.rb:21:in `chdir'
0
-./spec/spec/runner/formatter/html_formatter_spec.rb:21:</pre></div>
0
+/Users/david/projects/ruby/rspec/rspec/spec/spec/runner/formatter/html_formatter_spec.rb:25:
0
+/Users/david/projects/ruby/rspec/rspec/spec/spec/runner/formatter/html_formatter_spec.rb:21:in `chdir'
0
+/Users/david/projects/ruby/rspec/rspec/spec/spec/runner/formatter/html_formatter_spec.rb:21:</pre></div>
0
     <pre class="ruby"><code><span class="linenum">11</span> <span class="ident">it</span> <span class="punct">&quot;</span><span class="string">should fail when expected message not received</span><span class="punct">&quot;</span> <span class="keyword">do</span>
0
 <span class="linenum">12</span> <span class="ident">mock</span> <span class="punct">=</span> <span class="ident">mock</span><span class="punct">(&quot;</span><span class="string">poke me</span><span class="punct">&quot;)</span>
0
 <span class="offending"><span class="linenum">13</span> <span class="ident">mock</span><span class="punct">.</span><span class="ident">should_receive</span><span class="punct">(</span><span class="symbol">:poke</span><span class="punct">)</span></span>
0
@@ -205,9 +205,9 @@ a {
0
       <div class="failure" id="failure_2">
0
         <div class="message"><pre>Mock 'one two three' received :three out of order</pre></div>
0
         <div class="backtrace"><pre>./failing_examples/mocking_example.rb:22:
0
-./spec/spec/runner/formatter/html_formatter_spec.rb:25:
0
-./spec/spec/runner/formatter/html_formatter_spec.rb:21:in `chdir'
0
-./spec/spec/runner/formatter/html_formatter_spec.rb:21:</pre></div>
0
+/Users/david/projects/ruby/rspec/rspec/spec/spec/runner/formatter/html_formatter_spec.rb:25:
0
+/Users/david/projects/ruby/rspec/rspec/spec/spec/runner/formatter/html_formatter_spec.rb:21:in `chdir'
0
+/Users/david/projects/ruby/rspec/rspec/spec/spec/runner/formatter/html_formatter_spec.rb:21:</pre></div>
0
     <pre class="ruby"><code><span class="linenum">20</span> <span class="ident">mock</span><span class="punct">.</span><span class="ident">should_receive</span><span class="punct">(</span><span class="symbol">:three</span><span class="punct">).</span><span class="ident">ordered</span>
0
 <span class="linenum">21</span> <span class="ident">mock</span><span class="punct">.</span><span class="ident">one</span>
0
 <span class="offending"><span class="linenum">22</span> <span class="ident">mock</span><span class="punct">.</span><span class="ident">three</span></span>
0
@@ -221,9 +221,9 @@ a {
0
       <div class="failure" id="failure_3">
0
         <div class="message"><pre>Mock 'don't talk to me' expected :any_message_at_all with (no args) 0 times, but received it once</pre></div>
0
         <div class="backtrace"><pre>./failing_examples/mocking_example.rb:29:
0
-./spec/spec/runner/formatter/html_formatter_spec.rb:25:
0
-./spec/spec/runner/formatter/html_formatter_spec.rb:21:in `chdir'
0
-./spec/spec/runner/formatter/html_formatter_spec.rb:21:</pre></div>
0
+/Users/david/projects/ruby/rspec/rspec/spec/spec/runner/formatter/html_formatter_spec.rb:25:
0
+/Users/david/projects/ruby/rspec/rspec/spec/spec/runner/formatter/html_formatter_spec.rb:21:in `chdir'
0
+/Users/david/projects/ruby/rspec/rspec/spec/spec/runner/formatter/html_formatter_spec.rb:21:</pre></div>
0
     <pre class="ruby"><code><span class="linenum">27</span> <span class="ident">mock</span> <span class="punct">=</span> <span class="ident">mock</span><span class="punct">(&quot;</span><span class="string">don't talk to me</span><span class="punct">&quot;)</span>
0
 <span class="linenum">28</span> <span class="ident">mock</span><span class="punct">.</span><span class="ident">should_not_receive</span><span class="punct">(</span><span class="symbol">:any_message_at_all</span><span class="punct">)</span>
0
 <span class="offending"><span class="linenum">29</span> <span class="ident">mock</span><span class="punct">.</span><span class="ident">any_message_at_all</span></span>
0
@@ -236,9 +236,9 @@ a {
0
       <div class="failure" id="failure_4">
0
         <div class="message"><pre>Expected pending 'here is the bug' to fail. No Error was raised.</pre></div>
0
         <div class="backtrace"><pre>./failing_examples/mocking_example.rb:33:
0
-./spec/spec/runner/formatter/html_formatter_spec.rb:25:
0
-./spec/spec/runner/formatter/html_formatter_spec.rb:21:in `chdir'
0
-./spec/spec/runner/formatter/html_formatter_spec.rb:21:</pre></div>
0
+/Users/david/projects/ruby/rspec/rspec/spec/spec/runner/formatter/html_formatter_spec.rb:25:
0
+/Users/david/projects/ruby/rspec/rspec/spec/spec/runner/formatter/html_formatter_spec.rb:21:in `chdir'
0
+/Users/david/projects/ruby/rspec/rspec/spec/spec/runner/formatter/html_formatter_spec.rb:21:</pre></div>
0
     <pre class="ruby"><code><span class="linenum">31</span>
0
 <span class="linenum">32</span> <span class="ident">it</span> <span class="punct">&quot;</span><span class="string">has a bug we need to fix</span><span class="punct">&quot;</span> <span class="keyword">do</span>
0
 <span class="offending"><span class="linenum">33</span> <span class="ident">pending</span> <span class="punct">&quot;</span><span class="string">here is the bug</span><span class="punct">&quot;</span> <span class="keyword">do</span></span>
0
@@ -266,9 +266,9 @@ Diff:
0
  framework for Ruby
0
 </pre></div>
0
         <div class="backtrace"><pre>./failing_examples/diffing_spec.rb:13:
0
-./spec/spec/runner/formatter/html_formatter_spec.rb:25:
0
-./spec/spec/runner/formatter/html_formatter_spec.rb:21:in `chdir'
0
-./spec/spec/runner/formatter/html_formatter_spec.rb:21:</pre></div>
0
+/Users/david/projects/ruby/rspec/rspec/spec/spec/runner/formatter/html_formatter_spec.rb:25:
0
+/Users/david/projects/ruby/rspec/rspec/spec/spec/runner/formatter/html_formatter_spec.rb:21:in `chdir'
0
+/Users/david/projects/ruby/rspec/rspec/spec/spec/runner/formatter/html_formatter_spec.rb:21:</pre></div>
0
     <pre class="ruby"><code><span class="linenum">11</span><span class="ident">framework</span> <span class="keyword">for</span> <span class="constant">Ruby</span>
0
 <span class="linenum">12</span><span class="constant">EOF</span>
0
 <span class="offending"><span class="linenum">13</span> <span class="ident">usa</span><span class="punct">.</span><span class="ident">should</span> <span class="punct">==</span> <span class="ident">uk</span></span>
0
@@ -297,9 +297,9 @@ Diff:
0
  &gt;
0
 </pre></div>
0
         <div class="backtrace"><pre>./failing_examples/diffing_spec.rb:34:
0
-./spec/spec/runner/formatter/html_formatter_spec.rb:25:
0
-./spec/spec/runner/formatter/html_formatter_spec.rb:21:in `chdir'
0
-./spec/spec/runner/formatter/html_formatter_spec.rb:21:</pre></div>
0
+/Users/david/projects/ruby/rspec/rspec/spec/spec/runner/formatter/html_formatter_spec.rb:25:
0
+/Users/david/projects/ruby/rspec/rspec/spec/spec/runner/formatter/html_formatter_spec.rb:21:in `chdir'
0
+/Users/david/projects/ruby/rspec/rspec/spec/spec/runner/formatter/html_formatter_spec.rb:21:</pre></div>
0
     <pre class="ruby"><code><span class="linenum">32</span> <span class="ident">expected</span> <span class="punct">=</span> <span class="constant">Animal</span><span class="punct">.</span><span class="ident">new</span> <span class="punct">&quot;</span><span class="string">bob</span><span class="punct">&quot;,</span> <span class="punct">&quot;</span><span class="string">giraffe</span><span class="punct">&quot;</span>
0
 <span class="linenum">33</span> <span class="ident">actual</span> <span class="punct">=</span> <span class="constant">Animal</span><span class="punct">.</span><span class="ident">new</span> <span class="punct">&quot;</span><span class="string">bob</span><span class="punct">&quot;,</span> <span class="punct">&quot;</span><span class="string">tortoise</span><span class="punct">&quot;</span>
0
 <span class="offending"><span class="linenum">34</span> <span class="ident">expected</span><span class="punct">.</span><span class="ident">should</span> <span class="ident">eql</span><span class="punct">(</span><span class="ident">actual</span><span class="punct">)</span></span>
...
33
34
35
36
 
37
38
39
...
33
34
35
 
36
37
38
39
0
@@ -33,7 +33,7 @@ module Spec
0
               if opt == '--diff'
0
                 # Uncomment this line temporarily in order to overwrite the expected with actual.
0
                 # Use with care!!!
0
- File.open(expected_file, 'w') {|io| io.write(html)}
0
+ # File.open(expected_file, 'w') {|io| io.write(html)}
0
 
0
                 doc = Hpricot(html)
0
                 backtraces = doc.search("div.backtrace").collect {|e| e.at("/pre").inner_html}
...
17
18
19
20
 
21
22
23
24
25
 
26
27
28
...
40
41
42
43
 
44
45
46
47
48
 
49
50
51
52
53
 
54
55
56
...
58
59
60
61
 
62
63
64
65
66
67
 
68
69
70
...
72
73
74
75
 
76
77
78
...
84
85
86
87
 
88
89
90
91
92
 
93
94
95
96
97
 
98
99
100
101
102
 
103
104
105
106
107
 
108
109
110
111
112
 
113
114
115
116
117
 
118
119
120
...
126
127
128
129
 
130
131
132
133
134
 
135
136
137
138
139
 
140
141
142
143
144
 
145
146
147
148
149
 
150
151
152
...
156
157
158
159
 
160
161
162
163
164
 
165
166
167
168
169
 
170
171
172
173
174
 
175
176
177
178
179
 
180
181
182
183
184
 
185
186
187
188
189
 
190
191
192
193
194
 
195
196
197
198
199
200
 
201
202
203
204
205
206
 
207
208
209
 
210
211
212
213
214
215
216
 
217
218
219
220
221
 
222
223
224
...
226
227
228
229
 
230
231
232
233
 
234
235
236
237
238
239
240
 
241
242
243
...
245
246
247
248
 
249
250
251
252
253
254
255
 
256
257
258
259
260
261
262
 
263
264
265
266
267
268
 
269
270
271
272
273
274
275
 
276
277
278
...
285
286
287
288
 
289
290
291
292
293
294
 
295
296
297
...
299
300
301
302
303
 
 
304
305
306
...
316
317
318
319
 
320
321
322
323
324
325
326
 
327
328
329
...
337
338
339
340
 
341
342
343
...
345
346
347
348
 
349
350
351
...
354
355
356
357
 
358
359
360
...
363
364
365
366
 
367
368
369
...
372
373
374
375
 
376
377
378
...
17
18
19
 
20
21
22
23
24
 
25
26
27
28
...
40
41
42
 
43
44
45
46
47
 
48
49
50
51
52
 
53
54
55
56
...
58
59
60
 
61
62
63
64
65
66
 
67
68
69
70
...
72
73
74
 
75
76
77
78
...
84
85
86
 
87
88
89
90
91
 
92
93
94
95
96
 
97
98
99
100
101
 
102
103
104
105
106
 
107
108
109
110
111
 
112
113
114
115
116
 
117
118
119
120
...
126
127
128
 
129
130
131
132
133
 
134
135
136
137
138
 
139
140
141
142
143
 
144
145
146
147
148
 
149
150
151
152
...
156
157
158
 
159
160
161
162
163
 
164
165
166
167
168
 
169
170
171
172
173
 
174
175
176
177
178
 
179
180
181
182
183
 
184
185
186
187
188
 
189
190
191
192
193
 
194
195
196
197
198
199
 
200
201
202
203
204
205
 
206
207
208
 
209
210
211
212
213
214
215
 
216
217
218
219
220
 
221
222
223
224
...
226
227
228
 
229
230
231
232
 
233
234
235
236
237
238
239
 
240
241
242
243
...
245
246
247
 
248
249
250
251
252
253
254
 
255
256
257
258
259
260
261
 
262
263
264
265
266
267
 
268
269
270
271
272
273
274
 
275
276
277
278
...
285
286
287
 
288
289
290
291
292
293
 
294
295
296
297
...
299
300
301
 
 
302
303
304
305
306
...
316
317
318
 
319
320
321
322
323
324
325
 
326
327
328
329
...
337
338
339
 
340
341
342
343
...
345
346
347
 
348
349
350
351
...
354
355
356
 
357
358
359
360
...
363
364
365
 
366
367
368
369
...
372
373
374
 
375
376
377
378
0
@@ -17,12 +17,12 @@ describe "OptionParser" do
0
     options = parse(["--pattern", "foo"])
0
     options.filename_pattern.should == "foo"
0
   end
0
-
0
+
0
   it "should accept dry run option" do
0
     options = parse(["--dry-run"])
0
     options.dry_run.should be_true
0
   end
0
-
0
+
0
   it "should eval and use custom formatter when none of the builtins" do
0
     options = parse(["--format", "Custom::Formatter"])
0
     options.formatters[0].class.should be(Custom::Formatter)
0
@@ -40,17 +40,17 @@ describe "OptionParser" do
0
     options.formatters[2].where.should eql("foo\\bar")
0
     options.formatters[3].where.should eql("/foo/bar")
0
   end
0
-
0
+
0
   it "should not be verbose by default" do
0
     options = parse([])
0
     options.verbose.should be_nil
0
   end
0
-
0
+
0
   it "should not use colour by default" do
0
     options = parse([])
0
     options.colour.should == false
0
   end
0
-
0
+
0
   it "should print help to stdout if no args" do
0
     pending 'A regression since 1.0.8' do
0
       options = parse([])
0
@@ -58,13 +58,13 @@ describe "OptionParser" do
0
       @out.read.should match(/Usage: spec \(FILE\|DIRECTORY\|GLOB\)\+ \[options\]/m)
0
     end
0
   end
0
-
0
+
0
   it "should print help to stdout" do
0
     options = parse(["--help"])
0
     @out.rewind
0
     @out.read.should match(/Usage: spec \(FILE\|DIRECTORY\|GLOB\)\+ \[options\]/m)
0
   end
0
-
0
+
0
   it "should print instructions about how to require missing formatter" do
0
     lambda do
0
       options = parse(["--format", "Custom::MissingFormatter"])
0
@@ -72,7 +72,7 @@ describe "OptionParser" do
0
     end.should raise_error(NameError)
0
     @err.string.should match(/Couldn't find formatter class Custom::MissingFormatter/n)
0
   end
0
-
0
+
0
   it "should print version to stdout" do
0
     options = parse(["--version"])
0
     @out.rewind
0
@@ -84,37 +84,37 @@ describe "OptionParser" do
0
       parse(["--require", "whatever"])
0
     end.should raise_error(LoadError)
0
   end
0
-
0
+
0
   it "should support c option" do
0
     options = parse(["-c"])
0
     options.colour.should be_true
0
   end
0
-
0
+
0
   it "should support queens colour option" do
0
     options = parse(["--colour"])
0
     options.colour.should be_true
0
   end
0
-
0
+
0
   it "should support us color option" do
0
     options = parse(["--color"])
0
     options.colour.should be_true
0
   end
0
-
0
+
0
   it "should support single example with -e option" do
0
     options = parse(["-e", "something or other"])
0
     options.examples.should eql(["something or other"])
0
   end
0
-
0
+
0
   it "should support single example with -s option (will be removed when autotest supports -e)" do
0
     options = parse(["-s", "something or other"])
0
     options.examples.should eql(["something or other"])
0
   end
0
-
0
+
0
   it "should support single example with --example option" do
0
     options = parse(["--example", "something or other"])
0
     options.examples.should eql(["something or other"])
0
   end
0
-
0
+
0
   it "should read several example names from file if --example is given an existing file name" do
0
     options = parse(["--example", File.dirname(__FILE__) + '/examples.txt'])
0
     options.examples.should eql([
0
@@ -126,27 +126,27 @@ describe "OptionParser" do
0
     options = parse(["--example", File.dirname(__FILE__) + '/empty_file.txt'])
0
     options.examples.should eql([])
0
   end
0
-
0
+
0
   it "should use html formatter when format is h" do
0
     options = parse(["--format", "h"])
0
     options.formatters[0].class.should equal(Spec::Runner::Formatter::HtmlFormatter)
0
   end
0
-
0
+
0
   it "should use html story formatter when format is h" do
0
     options = parse(["--format", "h"])
0
     options.story_formatters[0].class.should equal(Spec::Runner::Formatter::Story::HtmlFormatter)
0
   end
0
-
0
+
0
   it "should use html formatter when format is html" do
0
     options = parse(["--format", "html"])
0
     options.formatters[0].class.should equal(Spec::Runner::Formatter::HtmlFormatter)
0
   end
0
-
0
+
0
   it "should use html story formatter when format is html" do
0
     options = parse(["--format", "html"])
0
     options.story_formatters[0].class.should equal(Spec::Runner::Formatter::Story::HtmlFormatter)
0
   end
0
-
0
+
0
   it "should use html formatter with explicit output when format is html:test.html" do
0
     FileUtils.rm 'test.html' if File.exist?('test.html')
0
     options = parse(["--format", "html:test.html"])
0
@@ -156,69 +156,69 @@ describe "OptionParser" do
0
     options.formatters[0].close
0
     FileUtils.rm 'test.html'
0
   end
0
-
0
+
0
   it "should use noisy backtrace tweaker with b option" do
0
     options = parse(["-b"])
0
     options.backtrace_tweaker.should be_instance_of(Spec::Runner::NoisyBacktraceTweaker)
0
   end
0
-
0
+
0
   it "should use noisy backtrace tweaker with backtrace option" do
0
     options = parse(["--backtrace"])
0
     options.backtrace_tweaker.should be_instance_of(Spec::Runner::NoisyBacktraceTweaker)
0
   end
0
-
0
+
0
   it "should use quiet backtrace tweaker by default" do
0
     options = parse([])
0
     options.backtrace_tweaker.should be_instance_of(Spec::Runner::QuietBacktraceTweaker)
0
   end
0
-
0
+
0
   it "should use progress bar formatter by default" do
0
     options = parse([])
0
     options.formatters[0].class.should equal(Spec::Runner::Formatter::ProgressBarFormatter)
0
   end
0
-
0
+
0
   it "should use specdoc formatter when format is s" do
0
     options = parse(["--format", "s"])
0
     options.formatters[0].class.should equal(Spec::Runner::Formatter::SpecdocFormatter)
0
   end
0
-
0
+
0
   it "should use specdoc formatter when format is specdoc" do
0
     options = parse(["--format", "specdoc"])
0
     options.formatters[0].class.should equal(Spec::Runner::Formatter::SpecdocFormatter)
0
   end
0
-
0
+
0
   it "should support diff option when format is not specified" do
0
     options = parse(["--diff"])
0
     options.diff_format.should == :unified
0
   end
0
-
0
+
0
   it "should use unified diff format option when format is unified" do
0
     options = parse(["--diff", "unified"])
0
     options.diff_format.should == :unified
0
     options.differ_class.should equal(Spec::Expectations::Differs::Default)
0
   end
0
-
0
+
0
   it "should use context diff format option when format is context" do
0
     options = parse(["--diff", "context"])
0
     options.diff_format.should == :context
0
     options.differ_class.should == Spec::Expectations::Differs::Default
0
   end
0
-
0
+
0
   it "should use custom diff format option when format is a custom format" do
0
     Spec::Expectations.differ.should_not be_instance_of(Custom::Differ)
0
-
0
+
0
     options = parse(["--diff", "Custom::Differ"])
0
     options.parse_diff "Custom::Differ"
0
     options.diff_format.should == :custom
0
     options.differ_class.should == Custom::Differ
0
     Spec::Expectations.differ.should be_instance_of(Custom::Differ)
0
   end
0
-
0
+
0
   it "should print instructions about how to fix missing differ" do
0
     lambda { parse(["--diff", "Custom::MissingFormatter"]) }.should raise_error(NameError)
0
     @err.string.should match(/Couldn't find differ class Custom::MissingFormatter/n)
0
   end
0
-
0
+
0
   describe "when attempting a focussed spec" do
0
     attr_reader :file, :dir
0
     before do
0
@@ -226,18 +226,18 @@ describe "OptionParser" do
0
       @file = "#{File.dirname(__FILE__)}/spec_parser/spec_parser_fixture.rb"
0
       @dir = File.dirname(file)
0
     end
0
-
0
+
0
     after do
0
       $rspec_options = @original_rspec_options
0
     end
0
-
0
+
0
     def parse(args)
0
       options = super
0
       $rspec_options = options
0
       options.filename_pattern = "*_fixture.rb"
0
       options
0
     end
0
-
0
+
0
     it "should support --line to identify spec" do
0
       options = parse([file, "--line", "13"])
0
       options.line_number.should == 13
0
@@ -245,34 +245,34 @@ describe "OptionParser&qu