| |   |
| 19 | 19 | "Separate multiple patterns with commas.", |
| 20 | 20 | "Applies only to directories named on the command line (files", |
| 21 | 21 | "named explicitly on the command line will be loaded regardless)."], |
| 22 | | :diff => ["-D", "--diff [FORMAT]", "Show diff of objects that are expected to be equal when they are not", |
| 22 | :diff => ["-D", "--diff [FORMAT]","Show diff of objects that are expected to be equal when they are not", |
| 23 | 23 | "Builtin formats: unified|u|context|c", |
| 24 | 24 | "You can also specify a custom differ class", |
| 25 | 25 | "(in which case you should also specify --require)"], |
| … | … | |
| 36 | 36 | :specification => ["-s", "--specification [NAME]", "DEPRECATED - use -e instead", "(This will be removed when autotest works with -e)"], |
| 37 | 37 | :line => ["-l", "--line LINE_NUMBER", Integer, "Execute behaviout or specification at given line.", |
| 38 | 38 | "(does not work for dynamically generated specs)"], |
| 39 | | :format => ["-f", "--format FORMAT[:WHERE]", "Specifies what format to use for output. Specify WHERE to tell", |
| 39 | :format => ["-f", "--format FORMAT[:WHERE]","Specifies what format to use for output. Specify WHERE to tell", |
| 40 | 40 | "the formatter where to write the output. All built-in formats", |
| 41 | 41 | "expect WHERE to be a file name, and will write to STDOUT if it's", |
| 42 | 42 | "not specified. The --format option may be specified several times", |
| … | … | |
| 57 | 57 | "FORMAT can also be the name of a custom formatter class", |
| 58 | 58 | "(in which case you should also specify --require to load it)"], |
| 59 | 59 | :require => ["-r", "--require FILE", "Require FILE before running specs", |
| 60 | | "Useful for loading custom formatters or other extensions.", |
| 61 | | "If this option is used it must come before the others"], |
| 60 | "Useful for loading custom formatters or other extensions.", |
| 61 | "If this option is used it must come before the others"], |
| 62 | 62 | :backtrace => ["-b", "--backtrace", "Output full backtrace"], |
| 63 | 63 | :loadby => ["-L", "--loadby STRATEGY", "Specify the strategy by which spec files should be loaded.", |
| 64 | | "STRATEGY can currently only be 'mtime' (File modification time)", |
| 65 | | "By default, spec files are loaded in alphabetical order if --loadby", |
| 66 | | "is not specified."], |
| 64 | "STRATEGY can currently only be 'mtime' (File modification time)", |
| 65 | "By default, spec files are loaded in alphabetical order if --loadby", |
| 66 | "is not specified."], |
| 67 | 67 | :reverse => ["-R", "--reverse", "Run examples in reverse order"], |
| 68 | 68 | :timeout => ["-t", "--timeout FLOAT", "Interrupt and fail each example that doesn't complete in the", |
| 69 | 69 | "specified time"], |
| … | … | |
| 107 | 107 | on(*OPTIONS[:heckle]) {|heckle| @options.load_heckle_runner(heckle)} |
| 108 | 108 | on(*OPTIONS[:dry_run]) {@options.dry_run = true} |
| 109 | 109 | on(*OPTIONS[:options_file]) {|options_file| parse_options_file(options_file)} |
| 110 | | on(*OPTIONS[:generate_options]) do |options_file| |
| 111 | | end |
| 112 | | on(*OPTIONS[:runner]) do |runner| |
| 113 | | @options.user_input_for_runner = runner |
| 114 | | end |
| 110 | on(*OPTIONS[:generate_options]) {|options_file|} |
| 111 | on(*OPTIONS[:runner]) {|runner| @options.user_input_for_runner = runner} |
| 115 | 112 | on(*OPTIONS[:drb]) {} |
| 116 | 113 | on(*OPTIONS[:version]) {parse_version} |
| 117 | 114 | on_tail(*OPTIONS[:help]) {parse_help} |
| … | … | |
| 176 | 176 | is_drb = false |
| 177 | 177 | is_drb ||= argv.delete(OPTIONS[:drb][0]) |
| 178 | 178 | is_drb ||= argv.delete(OPTIONS[:drb][1]) |
| 179 | | return nil unless is_drb |
| 179 | return false unless is_drb |
| 180 | 180 | @options.examples_should_not_be_run |
| 181 | 181 | DrbCommandLine.run( |
| 182 | 182 | self.class.parse(argv, @error_stream, @out_stream) |
| toggle raw diff |
--- a/rspec/lib/spec/runner/option_parser.rb
+++ b/rspec/lib/spec/runner/option_parser.rb
@@ -19,7 +19,7 @@ module Spec
"Separate multiple patterns with commas.",
"Applies only to directories named on the command line (files",
"named explicitly on the command line will be loaded regardless)."],
- :diff => ["-D", "--diff [FORMAT]", "Show diff of objects that are expected to be equal when they are not",
+ :diff => ["-D", "--diff [FORMAT]","Show diff of objects that are expected to be equal when they are not",
"Builtin formats: unified|u|context|c",
"You can also specify a custom differ class",
"(in which case you should also specify --require)"],
@@ -36,7 +36,7 @@ module Spec
:specification => ["-s", "--specification [NAME]", "DEPRECATED - use -e instead", "(This will be removed when autotest works with -e)"],
:line => ["-l", "--line LINE_NUMBER", Integer, "Execute behaviout or specification at given line.",
"(does not work for dynamically generated specs)"],
- :format => ["-f", "--format FORMAT[:WHERE]", "Specifies what format to use for output. Specify WHERE to tell",
+ :format => ["-f", "--format FORMAT[:WHERE]","Specifies what format to use for output. Specify WHERE to tell",
"the formatter where to write the output. All built-in formats",
"expect WHERE to be a file name, and will write to STDOUT if it's",
"not specified. The --format option may be specified several times",
@@ -57,13 +57,13 @@ module Spec
"FORMAT can also be the name of a custom formatter class",
"(in which case you should also specify --require to load it)"],
:require => ["-r", "--require FILE", "Require FILE before running specs",
- "Useful for loading custom formatters or other extensions.",
- "If this option is used it must come before the others"],
+ "Useful for loading custom formatters or other extensions.",
+ "If this option is used it must come before the others"],
:backtrace => ["-b", "--backtrace", "Output full backtrace"],
:loadby => ["-L", "--loadby STRATEGY", "Specify the strategy by which spec files should be loaded.",
- "STRATEGY can currently only be 'mtime' (File modification time)",
- "By default, spec files are loaded in alphabetical order if --loadby",
- "is not specified."],
+ "STRATEGY can currently only be 'mtime' (File modification time)",
+ "By default, spec files are loaded in alphabetical order if --loadby",
+ "is not specified."],
:reverse => ["-R", "--reverse", "Run examples in reverse order"],
:timeout => ["-t", "--timeout FLOAT", "Interrupt and fail each example that doesn't complete in the",
"specified time"],
@@ -107,11 +107,8 @@ module Spec
on(*OPTIONS[:heckle]) {|heckle| @options.load_heckle_runner(heckle)}
on(*OPTIONS[:dry_run]) {@options.dry_run = true}
on(*OPTIONS[:options_file]) {|options_file| parse_options_file(options_file)}
- on(*OPTIONS[:generate_options]) do |options_file|
- end
- on(*OPTIONS[:runner]) do |runner|
- @options.user_input_for_runner = runner
- end
+ on(*OPTIONS[:generate_options]) {|options_file|}
+ on(*OPTIONS[:runner]) {|runner| @options.user_input_for_runner = runner}
on(*OPTIONS[:drb]) {}
on(*OPTIONS[:version]) {parse_version}
on_tail(*OPTIONS[:help]) {parse_help}
@@ -179,7 +176,7 @@ module Spec
is_drb = false
is_drb ||= argv.delete(OPTIONS[:drb][0])
is_drb ||= argv.delete(OPTIONS[:drb][1])
- return nil unless is_drb
+ return false unless is_drb
@options.examples_should_not_be_run
DrbCommandLine.run(
self.class.parse(argv, @error_stream, @out_stream) |
| |   |
| 189 | 189 | <div class="failure" id="failure_1"> |
| 190 | 190 | <div class="message"><pre>Mock 'poke me' expected :poke with (any args) once, but received it 0 times</pre></div> |
| 191 | 191 | <div class="backtrace"><pre>./failing_examples/mocking_example.rb:13: |
| 192 | | ./spec/spec/runner/formatter/html_formatter_spec.rb:25: |
| 193 | | ./spec/spec/runner/formatter/html_formatter_spec.rb:21:in `chdir' |
| 194 | | ./spec/spec/runner/formatter/html_formatter_spec.rb:21:</pre></div> |
| 192 | /Users/david/projects/ruby/rspec/rspec/spec/spec/runner/formatter/html_formatter_spec.rb:25: |
| 193 | /Users/david/projects/ruby/rspec/rspec/spec/spec/runner/formatter/html_formatter_spec.rb:21:in `chdir' |
| 194 | /Users/david/projects/ruby/rspec/rspec/spec/spec/runner/formatter/html_formatter_spec.rb:21:</pre></div> |
| 195 | 195 | <pre class="ruby"><code><span class="linenum">11</span> <span class="ident">it</span> <span class="punct">"</span><span class="string">should fail when expected message not received</span><span class="punct">"</span> <span class="keyword">do</span> |
| 196 | 196 | <span class="linenum">12</span> <span class="ident">mock</span> <span class="punct">=</span> <span class="ident">mock</span><span class="punct">("</span><span class="string">poke me</span><span class="punct">")</span> |
| 197 | 197 | <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> |
| … | … | |
| 205 | 205 | <div class="failure" id="failure_2"> |
| 206 | 206 | <div class="message"><pre>Mock 'one two three' received :three out of order</pre></div> |
| 207 | 207 | <div class="backtrace"><pre>./failing_examples/mocking_example.rb:22: |
| 208 | | ./spec/spec/runner/formatter/html_formatter_spec.rb:25: |
| 209 | | ./spec/spec/runner/formatter/html_formatter_spec.rb:21:in `chdir' |
| 210 | | ./spec/spec/runner/formatter/html_formatter_spec.rb:21:</pre></div> |
| 208 | /Users/david/projects/ruby/rspec/rspec/spec/spec/runner/formatter/html_formatter_spec.rb:25: |
| 209 | /Users/david/projects/ruby/rspec/rspec/spec/spec/runner/formatter/html_formatter_spec.rb:21:in `chdir' |
| 210 | /Users/david/projects/ruby/rspec/rspec/spec/spec/runner/formatter/html_formatter_spec.rb:21:</pre></div> |
| 211 | 211 | <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> |
| 212 | 212 | <span class="linenum">21</span> <span class="ident">mock</span><span class="punct">.</span><span class="ident">one</span> |
| 213 | 213 | <span class="offending"><span class="linenum">22</span> <span class="ident">mock</span><span class="punct">.</span><span class="ident">three</span></span> |
| … | … | |
| 221 | 221 | <div class="failure" id="failure_3"> |
| 222 | 222 | <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> |
| 223 | 223 | <div class="backtrace"><pre>./failing_examples/mocking_example.rb:29: |
| 224 | | ./spec/spec/runner/formatter/html_formatter_spec.rb:25: |
| 225 | | ./spec/spec/runner/formatter/html_formatter_spec.rb:21:in `chdir' |
| 226 | | ./spec/spec/runner/formatter/html_formatter_spec.rb:21:</pre></div> |
| 224 | /Users/david/projects/ruby/rspec/rspec/spec/spec/runner/formatter/html_formatter_spec.rb:25: |
| 225 | /Users/david/projects/ruby/rspec/rspec/spec/spec/runner/formatter/html_formatter_spec.rb:21:in `chdir' |
| 226 | /Users/david/projects/ruby/rspec/rspec/spec/spec/runner/formatter/html_formatter_spec.rb:21:</pre></div> |
| 227 | 227 | <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">("</span><span class="string">don't talk to me</span><span class="punct">")</span> |
| 228 | 228 | <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> |
| 229 | 229 | <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> |
| … | … | |
| 236 | 236 | <div class="failure" id="failure_4"> |
| 237 | 237 | <div class="message"><pre>Expected pending 'here is the bug' to fail. No Error was raised.</pre></div> |
| 238 | 238 | <div class="backtrace"><pre>./failing_examples/mocking_example.rb:33: |
| 239 | | ./spec/spec/runner/formatter/html_formatter_spec.rb:25: |
| 240 | | ./spec/spec/runner/formatter/html_formatter_spec.rb:21:in `chdir' |
| 241 | | ./spec/spec/runner/formatter/html_formatter_spec.rb:21:</pre></div> |
| 239 | /Users/david/projects/ruby/rspec/rspec/spec/spec/runner/formatter/html_formatter_spec.rb:25: |
| 240 | /Users/david/projects/ruby/rspec/rspec/spec/spec/runner/formatter/html_formatter_spec.rb:21:in `chdir' |
| 241 | /Users/david/projects/ruby/rspec/rspec/spec/spec/runner/formatter/html_formatter_spec.rb:21:</pre></div> |
| 242 | 242 | <pre class="ruby"><code><span class="linenum">31</span> |
| 243 | 243 | <span class="linenum">32</span> <span class="ident">it</span> <span class="punct">"</span><span class="string">has a bug we need to fix</span><span class="punct">"</span> <span class="keyword">do</span> |
| 244 | 244 | <span class="offending"><span class="linenum">33</span> <span class="ident">pending</span> <span class="punct">"</span><span class="string">here is the bug</span><span class="punct">"</span> <span class="keyword">do</span></span> |
| … | … | |
| 266 | 266 | framework for Ruby |
| 267 | 267 | </pre></div> |
| 268 | 268 | <div class="backtrace"><pre>./failing_examples/diffing_spec.rb:13: |
| 269 | | ./spec/spec/runner/formatter/html_formatter_spec.rb:25: |
| 270 | | ./spec/spec/runner/formatter/html_formatter_spec.rb:21:in `chdir' |
| 271 | | ./spec/spec/runner/formatter/html_formatter_spec.rb:21:</pre></div> |
| 269 | /Users/david/projects/ruby/rspec/rspec/spec/spec/runner/formatter/html_formatter_spec.rb:25: |
| 270 | /Users/david/projects/ruby/rspec/rspec/spec/spec/runner/formatter/html_formatter_spec.rb:21:in `chdir' |
| 271 | /Users/david/projects/ruby/rspec/rspec/spec/spec/runner/formatter/html_formatter_spec.rb:21:</pre></div> |
| 272 | 272 | <pre class="ruby"><code><span class="linenum">11</span><span class="ident">framework</span> <span class="keyword">for</span> <span class="constant">Ruby</span> |
| 273 | 273 | <span class="linenum">12</span><span class="constant">EOF</span> |
| 274 | 274 | <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> |
| … | … | |
| 297 | 297 | > |
| 298 | 298 | </pre></div> |
| 299 | 299 | <div class="backtrace"><pre>./failing_examples/diffing_spec.rb:34: |
| 300 | | ./spec/spec/runner/formatter/html_formatter_spec.rb:25: |
| 301 | | ./spec/spec/runner/formatter/html_formatter_spec.rb:21:in `chdir' |
| 302 | | ./spec/spec/runner/formatter/html_formatter_spec.rb:21:</pre></div> |
| 300 | /Users/david/projects/ruby/rspec/rspec/spec/spec/runner/formatter/html_formatter_spec.rb:25: |
| 301 | /Users/david/projects/ruby/rspec/rspec/spec/spec/runner/formatter/html_formatter_spec.rb:21:in `chdir' |
| 302 | /Users/david/projects/ruby/rspec/rspec/spec/spec/runner/formatter/html_formatter_spec.rb:21:</pre></div> |
| 303 | 303 | <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">"</span><span class="string">bob</span><span class="punct">",</span> <span class="punct">"</span><span class="string">giraffe</span><span class="punct">"</span> |
| 304 | 304 | <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">"</span><span class="string">bob</span><span class="punct">",</span> <span class="punct">"</span><span class="string">tortoise</span><span class="punct">"</span> |
| 305 | 305 | <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> |
| toggle raw diff |
--- a/rspec/spec/spec/runner/formatter/html_formatted-1.8.6.html
+++ b/rspec/spec/spec/runner/formatter/html_formatted-1.8.6.html
@@ -189,9 +189,9 @@ a {
<div class="failure" id="failure_1">
<div class="message"><pre>Mock 'poke me' expected :poke with (any args) once, but received it 0 times</pre></div>
<div class="backtrace"><pre>./failing_examples/mocking_example.rb:13:
-./spec/spec/runner/formatter/html_formatter_spec.rb:25:
-./spec/spec/runner/formatter/html_formatter_spec.rb:21:in `chdir'
-./spec/spec/runner/formatter/html_formatter_spec.rb:21:</pre></div>
+/Users/david/projects/ruby/rspec/rspec/spec/spec/runner/formatter/html_formatter_spec.rb:25:
+/Users/david/projects/ruby/rspec/rspec/spec/spec/runner/formatter/html_formatter_spec.rb:21:in `chdir'
+/Users/david/projects/ruby/rspec/rspec/spec/spec/runner/formatter/html_formatter_spec.rb:21:</pre></div>
<pre class="ruby"><code><span class="linenum">11</span> <span class="ident">it</span> <span class="punct">"</span><span class="string">should fail when expected message not received</span><span class="punct">"</span> <span class="keyword">do</span>
<span class="linenum">12</span> <span class="ident">mock</span> <span class="punct">=</span> <span class="ident">mock</span><span class="punct">("</span><span class="string">poke me</span><span class="punct">")</span>
<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>
@@ -205,9 +205,9 @@ a {
<div class="failure" id="failure_2">
<div class="message"><pre>Mock 'one two three' received :three out of order</pre></div>
<div class="backtrace"><pre>./failing_examples/mocking_example.rb:22:
-./spec/spec/runner/formatter/html_formatter_spec.rb:25:
-./spec/spec/runner/formatter/html_formatter_spec.rb:21:in `chdir'
-./spec/spec/runner/formatter/html_formatter_spec.rb:21:</pre></div>
+/Users/david/projects/ruby/rspec/rspec/spec/spec/runner/formatter/html_formatter_spec.rb:25:
+/Users/david/projects/ruby/rspec/rspec/spec/spec/runner/formatter/html_formatter_spec.rb:21:in `chdir'
+/Users/david/projects/ruby/rspec/rspec/spec/spec/runner/formatter/html_formatter_spec.rb:21:</pre></div>
<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>
<span class="linenum">21</span> <span class="ident">mock</span><span class="punct">.</span><span class="ident">one</span>
<span class="offending"><span class="linenum">22</span> <span class="ident">mock</span><span class="punct">.</span><span class="ident">three</span></span>
@@ -221,9 +221,9 @@ a {
<div class="failure" id="failure_3">
<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>
<div class="backtrace"><pre>./failing_examples/mocking_example.rb:29:
-./spec/spec/runner/formatter/html_formatter_spec.rb:25:
-./spec/spec/runner/formatter/html_formatter_spec.rb:21:in `chdir'
-./spec/spec/runner/formatter/html_formatter_spec.rb:21:</pre></div>
+/Users/david/projects/ruby/rspec/rspec/spec/spec/runner/formatter/html_formatter_spec.rb:25:
+/Users/david/projects/ruby/rspec/rspec/spec/spec/runner/formatter/html_formatter_spec.rb:21:in `chdir'
+/Users/david/projects/ruby/rspec/rspec/spec/spec/runner/formatter/html_formatter_spec.rb:21:</pre></div>
<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">("</span><span class="string">don't talk to me</span><span class="punct">")</span>
<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>
<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>
@@ -236,9 +236,9 @@ a {
<div class="failure" id="failure_4">
<div class="message"><pre>Expected pending 'here is the bug' to fail. No Error was raised.</pre></div>
<div class="backtrace"><pre>./failing_examples/mocking_example.rb:33:
-./spec/spec/runner/formatter/html_formatter_spec.rb:25:
-./spec/spec/runner/formatter/html_formatter_spec.rb:21:in `chdir'
-./spec/spec/runner/formatter/html_formatter_spec.rb:21:</pre></div>
+/Users/david/projects/ruby/rspec/rspec/spec/spec/runner/formatter/html_formatter_spec.rb:25:
+/Users/david/projects/ruby/rspec/rspec/spec/spec/runner/formatter/html_formatter_spec.rb:21:in `chdir'
+/Users/david/projects/ruby/rspec/rspec/spec/spec/runner/formatter/html_formatter_spec.rb:21:</pre></div>
<pre class="ruby"><code><span class="linenum">31</span>
<span class="linenum">32</span> <span class="ident">it</span> <span class="punct">"</span><span class="string">has a bug we need to fix</span><span class="punct">"</span> <span class="keyword">do</span>
<span class="offending"><span class="linenum">33</span> <span class="ident">pending</span> <span class="punct">"</span><span class="string">here is the bug</span><span class="punct">"</span> <span class="keyword">do</span></span>
@@ -266,9 +266,9 @@ Diff:
framework for Ruby
</pre></div>
<div class="backtrace"><pre>./failing_examples/diffing_spec.rb:13:
-./spec/spec/runner/formatter/html_formatter_spec.rb:25:
-./spec/spec/runner/formatter/html_formatter_spec.rb:21:in `chdir'
-./spec/spec/runner/formatter/html_formatter_spec.rb:21:</pre></div>
+/Users/david/projects/ruby/rspec/rspec/spec/spec/runner/formatter/html_formatter_spec.rb:25:
+/Users/david/projects/ruby/rspec/rspec/spec/spec/runner/formatter/html_formatter_spec.rb:21:in `chdir'
+/Users/david/projects/ruby/rspec/rspec/spec/spec/runner/formatter/html_formatter_spec.rb:21:</pre></div>
<pre class="ruby"><code><span class="linenum">11</span><span class="ident">framework</span> <span class="keyword">for</span> <span class="constant">Ruby</span>
<span class="linenum">12</span><span class="constant">EOF</span>
<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>
@@ -297,9 +297,9 @@ Diff:
>
</pre></div>
<div class="backtrace"><pre>./failing_examples/diffing_spec.rb:34:
-./spec/spec/runner/formatter/html_formatter_spec.rb:25:
-./spec/spec/runner/formatter/html_formatter_spec.rb:21:in `chdir'
-./spec/spec/runner/formatter/html_formatter_spec.rb:21:</pre></div>
+/Users/david/projects/ruby/rspec/rspec/spec/spec/runner/formatter/html_formatter_spec.rb:25:
+/Users/david/projects/ruby/rspec/rspec/spec/spec/runner/formatter/html_formatter_spec.rb:21:in `chdir'
+/Users/david/projects/ruby/rspec/rspec/spec/spec/runner/formatter/html_formatter_spec.rb:21:</pre></div>
<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">"</span><span class="string">bob</span><span class="punct">",</span> <span class="punct">"</span><span class="string">giraffe</span><span class="punct">"</span>
<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">"</span><span class="string">bob</span><span class="punct">",</span> <span class="punct">"</span><span class="string">tortoise</span><span class="punct">"</span>
<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> |
| |   |
| 17 | 17 | options = parse(["--pattern", "foo"]) |
| 18 | 18 | options.filename_pattern.should == "foo" |
| 19 | 19 | end |
| 20 | | |
| 20 | |
| 21 | 21 | it "should accept dry run option" do |
| 22 | 22 | options = parse(["--dry-run"]) |
| 23 | 23 | options.dry_run.should be_true |
| 24 | 24 | end |
| 25 | | |
| 25 | |
| 26 | 26 | it "should eval and use custom formatter when none of the builtins" do |
| 27 | 27 | options = parse(["--format", "Custom::Formatter"]) |
| 28 | 28 | options.formatters[0].class.should be(Custom::Formatter) |
| … | … | |
| 40 | 40 | options.formatters[2].where.should eql("foo\\bar") |
| 41 | 41 | options.formatters[3].where.should eql("/foo/bar") |
| 42 | 42 | end |
| 43 | | |
| 43 | |
| 44 | 44 | it "should not be verbose by default" do |
| 45 | 45 | options = parse([]) |
| 46 | 46 | options.verbose.should be_nil |
| 47 | 47 | end |
| 48 | | |
| 48 | |
| 49 | 49 | it "should not use colour by default" do |
| 50 | 50 | options = parse([]) |
| 51 | 51 | options.colour.should == false |
| 52 | 52 | end |
| 53 | | |
| 53 | |
| 54 | 54 | it "should print help to stdout if no args" do |
| 55 | 55 | pending 'A regression since 1.0.8' do |
| 56 | 56 | options = parse([]) |
| … | … | |
| 58 | 58 | @out.read.should match(/Usage: spec \(FILE\|DIRECTORY\|GLOB\)\+ \[options\]/m) |
| 59 | 59 | end |
| 60 | 60 | end |
| 61 | | |
| 61 | |
| 62 | 62 | it "should print help to stdout" do |
| 63 | 63 | options = parse(["--help"]) |
| 64 | 64 | @out.rewind |
| 65 | 65 | @out.read.should match(/Usage: spec \(FILE\|DIRECTORY\|GLOB\)\+ \[options\]/m) |
| 66 | 66 | end |
| 67 | | |
| 67 | |
| 68 | 68 | it "should print instructions about how to require missing formatter" do |
| 69 | 69 | lambda do |
| 70 | 70 | options = parse(["--format", "Custom::MissingFormatter"]) |
| … | … | |
| 72 | 72 | end.should raise_error(NameError) |
| 73 | 73 | @err.string.should match(/Couldn't find formatter class Custom::MissingFormatter/n) |
| 74 | 74 | end |
| 75 | | |
| 75 | |
| 76 | 76 | it "should print version to stdout" do |
| 77 | 77 | options = parse(["--version"]) |
| 78 | 78 | @out.rewind |
| … | … | |
| 84 | 84 | parse(["--require", "whatever"]) |
| 85 | 85 | end.should raise_error(LoadError) |
| 86 | 86 | end |
| 87 | | |
| 87 | |
| 88 | 88 | it "should support c option" do |
| 89 | 89 | options = parse(["-c"]) |
| 90 | 90 | options.colour.should be_true |
| 91 | 91 | end |
| 92 | | |
| 92 | |
| 93 | 93 | it "should support queens colour option" do |
| 94 | 94 | options = parse(["--colour"]) |
| 95 | 95 | options.colour.should be_true |
| 96 | 96 | end |
| 97 | | |
| 97 | |
| 98 | 98 | it "should support us color option" do |
| 99 | 99 | options = parse(["--color"]) |
| 100 | 100 | options.colour.should be_true |
| 101 | 101 | end |
| 102 | | |
| 102 | |
| 103 | 103 | it "should support single example with -e option" do |
| 104 | 104 | options = parse(["-e", "something or other"]) |
| 105 | 105 | options.examples.should eql(["something or other"]) |
| 106 | 106 | end |
| 107 | | |
| 107 | |
| 108 | 108 | it "should support single example with -s option (will be removed when autotest supports -e)" do |
| 109 | 109 | options = parse(["-s", "something or other"]) |
| 110 | 110 | options.examples.should eql(["something or other"]) |
| 111 | 111 | end |
| 112 | | |
| 112 | |
| 113 | 113 | it "should support single example with --example option" do |
| 114 | 114 | options = parse(["--example", "something or other"]) |
| 115 | 115 | options.examples.should eql(["something or other"]) |
| 116 | 116 | end |
| 117 | | |
| 117 | |
| 118 | 118 | it "should read several example names from file if --example is given an existing file name" do |
| 119 | 119 | options = parse(["--example", File.dirname(__FILE__) + '/examples.txt']) |
| 120 | 120 | options.examples.should eql([ |
| … | … | |
| 126 | 126 | options = parse(["--example", File.dirname(__FILE__) + '/empty_file.txt']) |
| 127 | 127 | options.examples.should eql([]) |
| 128 | 128 | end |
| 129 | | |
| 129 | |
| 130 | 130 | it "should use html formatter when format is h" do |
| 131 | 131 | options = parse(["--format", "h"]) |
| 132 | 132 | options.formatters[0].class.should equal(Spec::Runner::Formatter::HtmlFormatter) |
| 133 | 133 | end |
| 134 | | |
| 134 | |
| 135 | 135 | it "should use html story formatter when format is h" do |
| 136 | 136 | options = parse(["--format", "h"]) |
| 137 | 137 | options.story_formatters[0].class.should equal(Spec::Runner::Formatter::Story::HtmlFormatter) |
| 138 | 138 | end |
| 139 | | |
| 139 | |
| 140 | 140 | it "should use html formatter when format is html" do |
| 141 | 141 | options = parse(["--format", "html"]) |
| 142 | 142 | options.formatters[0].class.should equal(Spec::Runner::Formatter::HtmlFormatter) |
| 143 | 143 | end |
| 144 | | |
| 144 | |
| 145 | 145 | it "should use html story formatter when format is html" do |
| 146 | 146 | options = parse(["--format", "html"]) |
| 147 | 147 | options.story_formatters[0].class.should equal(Spec::Runner::Formatter::Story::HtmlFormatter) |
| 148 | 148 | end |
| 149 | | |
| 149 | |
| 150 | 150 | it "should use html formatter with explicit output when format is html:test.html" do |
| 151 | 151 | FileUtils.rm 'test.html' if File.exist?('test.html') |
| 152 | 152 | options = parse(["--format", "html:test.html"]) |
| … | … | |
| 156 | 156 | options.formatters[0].close |
| 157 | 157 | FileUtils.rm 'test.html' |
| 158 | 158 | end |
| 159 | | |
| 159 | |
| 160 | 160 | it "should use noisy backtrace tweaker with b option" do |
| 161 | 161 | options = parse(["-b"]) |
| 162 | 162 | options.backtrace_tweaker.should be_instance_of(Spec::Runner::NoisyBacktraceTweaker) |
| 163 | 163 | end |
| 164 | | |
| 164 | |
| 165 | 165 | it "should use noisy backtrace tweaker with backtrace option" do |
| 166 | 166 | options = parse(["--backtrace"]) |
| 167 | 167 | options.backtrace_tweaker.should be_instance_of(Spec::Runner::NoisyBacktraceTweaker) |
| 168 | 168 | end |
| 169 | | |
| 169 | |
| 170 | 170 | it "should use quiet backtrace tweaker by default" do |
| 171 | 171 | options = parse([]) |
| 172 | 172 | options.backtrace_tweaker.should be_instance_of(Spec::Runner::QuietBacktraceTweaker) |
| 173 | 173 | end |
| 174 | | |
| 174 | |
| 175 | 175 | it "should use progress bar formatter by default" do |
| 176 | 176 | options = parse([]) |
| 177 | 177 | options.formatters[0].class.should equal(Spec::Runner::Formatter::ProgressBarFormatter) |
| 178 | 178 | end |
| 179 | | |
| 179 | |
| 180 | 180 | it "should use specdoc formatter when format is s" do |
| 181 | 181 | options = parse(["--format", "s"]) |
| 182 | 182 | options.formatters[0].class.should equal(Spec::Runner::Formatter::SpecdocFormatter) |
| 183 | 183 | end |
| 184 | | |
| 184 | |
| 185 | 185 | it "should use specdoc formatter when format is specdoc" do |
| 186 | 186 | options = parse(["--format", "specdoc"]) |
| 187 | 187 | options.formatters[0].class.should equal(Spec::Runner::Formatter::SpecdocFormatter) |
| 188 | 188 | end |
| 189 | | |
| 189 | |
| 190 | 190 | it "should support diff option when format is not specified" do |
| 191 | 191 | options = parse(["--diff"]) |
| 192 | 192 | options.diff_format.should == :unified |
| 193 | 193 | end |
| 194 | | |
| 194 | |
| 195 | 195 | it "should use unified diff format option when format is unified" do |
| 196 | 196 | options = parse(["--diff", "unified"]) |
| 197 | 197 | options.diff_format.should == :unified |
| 198 | 198 | options.differ_class.should equal(Spec::Expectations::Differs::Default) |
| 199 | 199 | end |
| 200 | | |
| 200 | |
| 201 | 201 | it "should use context diff format option when format is context" do |
| 202 | 202 | options = parse(["--diff", "context"]) |
| 203 | 203 | options.diff_format.should == :context |
| 204 | 204 | options.differ_class.should == Spec::Expectations::Differs::Default |
| 205 | 205 | end |
| 206 | | |
| 206 | |
| 207 | 207 | it "should use custom diff format option when format is a custom format" do |
| 208 | 208 | Spec::Expectations.differ.should_not be_instance_of(Custom::Differ) |
| 209 | | |
| 209 | |
| 210 | 210 | options = parse(["--diff", "Custom::Differ"]) |
| 211 | 211 | options.parse_diff "Custom::Differ" |
| 212 | 212 | options.diff_format.should == :custom |
| 213 | 213 | options.differ_class.should == Custom::Differ |
| 214 | 214 | Spec::Expectations.differ.should be_instance_of(Custom::Differ) |
| 215 | 215 | end |
| 216 | | |
| 216 | |
| 217 | 217 | it "should print instructions about how to fix missing differ" do |
| 218 | 218 | lambda { parse(["--diff", "Custom::MissingFormatter"]) }.should raise_error(NameError) |
| 219 | 219 | @err.string.should match(/Couldn't find differ class Custom::MissingFormatter/n) |
| 220 | 220 | end |
| 221 | | |
| 221 | |
| 222 | 222 | describe "when attempting a focussed spec" do |
| 223 | 223 | attr_reader :file, :dir |
| 224 | 224 | before do |
| … | … | |
| 226 | 226 | @file = "#{File.dirname(__FILE__)}/spec_parser/spec_parser_fixture.rb" |
| 227 | 227 | @dir = File.dirname(file) |
| 228 | 228 | end |
| 229 | | |
| 229 | |
| 230 | 230 | after do |
| 231 | 231 | $rspec_options = @original_rspec_options |
| 232 | 232 | end |
| 233 | | |
| 233 | |
| 234 | 234 | def parse(args) |
| 235 | 235 | options = super |
| 236 | 236 | $rspec_options = options |
| 237 | 237 | options.filename_pattern = "*_fixture.rb" |
| 238 | 238 | options |
| 239 | 239 | end |
| 240 | | |
| 240 | |
| 241 | 241 | it "should support --line to identify spec" do |
| 242 | 242 | options = parse([file, "--line", "13"]) |
| 243 | 243 | options.line_number.should == 13 |
| … | … | |
| 245 | 245 | options.run_examples |
| 246 | 246 | options.examples.should eql(["d"]) |
| 247 | 247 | end |
| 248 | | |
| 248 | |
| 249 | 249 | it "should fail with error message if file is dir along with --line" do |
| 250 | 250 | options = parse([dir, "--line", "169"]) |
| 251 | 251 | options.line_number.should == 169 |
| 252 | 252 | options.run_examples |
| 253 | 253 | @err.string.should match(/You must specify one file, not a directory when using the --line option/n) |
| 254 | 254 | end |
| 255 | | |
| 255 | |
| 256 | 256 | it "should fail with error message if file does not exist along with --line" do |
| 257 | 257 | options = parse(["some file", "--line", "169"]) |
| 258 | 258 | proc do |
| 259 | 259 | options.run_examples |
| 260 | 260 | end.should raise_error |
| 261 | 261 | end |
| 262 | | |
| 262 | |
| 263 | 263 | it "should fail with error message if more than one files are specified along with --line" do |
| 264 | 264 | options = parse([file, file, "--line", "169"]) |
| 265 | 265 | options.run_examples |
| 266 | 266 | @err.string.should match(/Only one file can be specified when using the --line option/n) |
| 267 | 267 | end |
| 268 | | |
| 268 | |
| 269 | 269 | it "should fail with error message if --example and --line are used simultaneously" do |
| 270 | 270 | options = parse([file, "--example", "some example", "--line", "169"]) |
| 271 | 271 | options.run_examples |
| 272 | 272 | @err.string.should match(/You cannot use both --line and --example/n) |
| 273 | 273 | end |
| 274 | 274 | end |
| 275 | | |
| 275 | |
| 276 | 276 | if [/mswin/, /java/].detect{|p| p =~ RUBY_PLATFORM} |
| 277 | 277 | it "should barf when --heckle is specified (and platform is windows)" do |
| 278 | 278 | lambda do |
| … | … | |
| 285 | 285 | options.heckle_runner.should be_instance_of(Spec::Runner::HeckleRunner) |
| 286 | 286 | end |
| 287 | 287 | end |
| 288 | | |
| 288 | |
| 289 | 289 | it "should read options from file when --options is specified" do |
| 290 | 290 | options = parse(["--options", File.dirname(__FILE__) + "/spec.opts"]) |
| 291 | 291 | options.diff_format.should_not be_nil |
| 292 | 292 | options.colour.should be_true |
| 293 | 293 | end |
| 294 | | |
| 294 | |
| 295 | 295 | it "should default the formatter to ProgressBarFormatter when using options file" do |
| 296 | 296 | options = parse(["--options", File.dirname(__FILE__) + "/spec.opts"]) |
| 297 | 297 | options.formatters.first.should be_instance_of(::Spec::Runner::Formatter::ProgressBarFormatter) |
| … | … | |
| 299 | 299 | |
| 300 | 300 | it "should run parse drb after parsing options" do |
| 301 | 301 | @parser.stub!(:parse_drb) |
| 302 | | @parser.should_receive(:parse_drb).with(["--drb"]) |
| 303 | | options = parse(["--options", File.dirname(__FILE__) + "/spec_drb.opts"]) |
| 302 | @parser.should_receive(:parse_drb).with(["--drb"]).and_return(true) |
| 303 | options = parse(["--options", File.dirname(__FILE__) + "/spec_drb.opts"]) |
| 304 | 304 | end |
| 305 | 305 | |
| 306 | 306 | it "should read spaced and multi-line options from file when --options is specified" do |
| … | … | |
| 316 | 316 | IO.read('test.spec.opts').should == "--colour\n--diff\n" |
| 317 | 317 | FileUtils.rm 'test.spec.opts' |
| 318 | 318 | end |
| 319 | | |
| 319 | |
| 320 | 320 | it "should save config to file when -G is specified" do |
| 321 | 321 | FileUtils.rm 'test.spec.opts' if File.exist?('test.spec.opts') |
| 322 | 322 | options = parse(["--colour", "-G", "test.spec.opts", "--diff"]) |
| 323 | 323 | IO.read('test.spec.opts').should == "--colour\n--diff\n" |
| 324 | 324 | FileUtils.rm 'test.spec.opts' |
| 325 | 325 | end |
| 326 | | |
| 326 | |
| 327 | 327 | it "when --drb is specified, calls DrbCommandLine all of the other ARGV arguments" do |
| 328 | 328 | options = Spec::Runner::OptionParser.parse([ |
| 329 | 329 | "some/spec.rb", "--diff", "--colour" |
| … | … | |
| 337 | 337 | it "should reverse spec order when --reverse is specified" do |
| 338 | 338 | options = parse(["some/spec.rb", "--reverse"]) |
| 339 | 339 | end |
| 340 | | |
| 340 | |
| 341 | 341 | it "should set an mtime comparator when --loadby mtime" do |
| 342 | 342 | options = parse(["--loadby", 'mtime']) |
| 343 | 343 | runner = Spec::Runner::ExampleGroupRunner.new(options) |
| … | … | |
| 345 | 345 | with(options). |
| 346 | 346 | and_return(runner) |
| 347 | 347 | runner.should_receive(:load_files).with(["most_recent_spec.rb", "command_line_spec.rb"]) |
| 348 | | |
| 348 | |
| 349 | 349 | Dir.chdir(File.dirname(__FILE__)) do |
| 350 | 350 | options.files << 'command_line_spec.rb' |
| 351 | 351 | options.files << 'most_recent_spec.rb' |
| … | … | |
|