rspec 1.0.5 → 1.0.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (87) hide show
  1. data/CHANGES +78 -1
  2. data/EXAMPLES.rd +8 -5
  3. data/README +1 -0
  4. data/Rakefile +1 -1
  5. data/examples/pending_example.rb +20 -0
  6. data/lib/autotest/rspec.rb +46 -18
  7. data/lib/spec/dsl.rb +1 -0
  8. data/lib/spec/dsl/behaviour.rb +37 -27
  9. data/lib/spec/dsl/behaviour_callbacks.rb +4 -0
  10. data/lib/spec/dsl/behaviour_eval.rb +27 -16
  11. data/lib/spec/dsl/behaviour_factory.rb +2 -2
  12. data/lib/spec/dsl/composite_proc_builder.rb +9 -4
  13. data/lib/spec/dsl/configuration.rb +20 -4
  14. data/lib/spec/dsl/description.rb +7 -0
  15. data/lib/spec/dsl/errors.rb +9 -0
  16. data/lib/spec/dsl/example.rb +18 -10
  17. data/lib/spec/matchers/have.rb +10 -13
  18. data/lib/spec/matchers/operator_matcher.rb +3 -3
  19. data/lib/spec/matchers/raise_error.rb +8 -3
  20. data/lib/spec/mocks/error_generator.rb +1 -1
  21. data/lib/spec/mocks/message_expectation.rb +11 -0
  22. data/lib/spec/mocks/methods.rb +9 -5
  23. data/lib/spec/mocks/proxy.rb +13 -9
  24. data/lib/spec/rake/spectask.rb +80 -38
  25. data/lib/spec/runner/backtrace_tweaker.rb +2 -1
  26. data/lib/spec/runner/behaviour_runner.rb +37 -16
  27. data/lib/spec/runner/formatter/base_formatter.rb +23 -15
  28. data/lib/spec/runner/formatter/base_text_formatter.rb +39 -11
  29. data/lib/spec/runner/formatter/failing_behaviours_formatter.rb +7 -3
  30. data/lib/spec/runner/formatter/failing_examples_formatter.rb +3 -3
  31. data/lib/spec/runner/formatter/html_formatter.rb +32 -25
  32. data/lib/spec/runner/formatter/progress_bar_formatter.rb +6 -5
  33. data/lib/spec/runner/formatter/rdoc_formatter.rb +6 -6
  34. data/lib/spec/runner/formatter/specdoc_formatter.rb +7 -6
  35. data/lib/spec/runner/option_parser.rb +6 -5
  36. data/lib/spec/runner/options.rb +60 -43
  37. data/lib/spec/runner/reporter.rb +17 -6
  38. data/lib/spec/runner/spec_parser.rb +1 -1
  39. data/lib/spec/translator.rb +8 -0
  40. data/lib/spec/version.rb +3 -3
  41. data/plugins/mock_frameworks/flexmock.rb +14 -18
  42. data/plugins/mock_frameworks/mocha.rb +0 -2
  43. data/plugins/mock_frameworks/rr.rb +21 -0
  44. data/spec/autotest/discover_spec.rb +19 -0
  45. data/spec/autotest/rspec_spec.rb +257 -0
  46. data/spec/autotest_helper.rb +4 -0
  47. data/spec/spec/dsl/behaviour_eval_spec.rb +30 -0
  48. data/spec/spec/dsl/behaviour_factory_spec.rb +18 -0
  49. data/spec/spec/dsl/behaviour_spec.rb +95 -58
  50. data/spec/spec/dsl/composite_proc_builder_spec.rb +0 -13
  51. data/spec/spec/dsl/configuration_spec.rb +6 -1
  52. data/spec/spec/dsl/description_spec.rb +9 -1
  53. data/spec/spec/dsl/example_class_spec.rb +3 -3
  54. data/spec/spec/dsl/example_instance_spec.rb +26 -28
  55. data/spec/spec/dsl/example_matcher_spec.rb +91 -0
  56. data/spec/spec/dsl/shared_behaviour_spec.rb +24 -0
  57. data/spec/spec/expectations/extensions/object_spec.rb +2 -2
  58. data/spec/spec/expectations/fail_with_spec.rb +2 -2
  59. data/spec/spec/matchers/have_spec.rb +1 -1
  60. data/spec/spec/matchers/operator_matcher_spec.rb +10 -10
  61. data/spec/spec/matchers/raise_error_spec.rb +38 -0
  62. data/spec/spec/mocks/argument_expectation_spec.rb +18 -14
  63. data/spec/spec/mocks/at_most_spec.rb +1 -1
  64. data/spec/spec/mocks/bug_report_11545_spec.rb +31 -0
  65. data/spec/spec/mocks/partial_mock_spec.rb +33 -1
  66. data/spec/spec/runner/behaviour_runner_spec.rb +72 -49
  67. data/spec/spec/runner/command_line_spec.rb +1 -1
  68. data/spec/spec/runner/context_matching_spec.rb +10 -10
  69. data/spec/spec/runner/drb_command_line_spec.rb +62 -59
  70. data/spec/spec/runner/extensions/bug_report_10577_spec.rb +35 -0
  71. data/spec/spec/runner/formatter/failing_behaviours_formatter_spec.rb +15 -2
  72. data/spec/spec/runner/formatter/failing_examples_formatter_spec.rb +3 -3
  73. data/spec/spec/runner/formatter/html_formatter_spec.rb +1 -1
  74. data/spec/spec/runner/formatter/progress_bar_formatter_dry_run_spec.rb +14 -15
  75. data/spec/spec/runner/formatter/progress_bar_formatter_failure_dump_spec.rb +1 -1
  76. data/spec/spec/runner/formatter/progress_bar_formatter_spec.rb +42 -9
  77. data/spec/spec/runner/formatter/rdoc_formatter_spec.rb +40 -40
  78. data/spec/spec/runner/formatter/specdoc_formatter_spec.rb +55 -49
  79. data/spec/spec/runner/option_parser_spec.rb +16 -15
  80. data/spec/spec/runner/options_spec.rb +64 -31
  81. data/spec/spec/runner/reporter_spec.rb +67 -15
  82. data/spec/spec/spec_classes.rb +9 -1
  83. data/spec/spec/translator_spec.rb +48 -0
  84. data/spec/spec_helper.rb +5 -2
  85. metadata +13 -6
  86. data/examples/not_yet_implemented_spec.rb +0 -12
  87. data/spec/spec/runner/example_matcher_spec.rb +0 -127
@@ -0,0 +1,35 @@
1
+ require File.dirname(__FILE__) + '/../../../spec_helper.rb'
2
+ require 'delegate'
3
+
4
+ module Bug10577
5
+ class OCI8
6
+ def describe(name)
7
+ "Hello, #{name}"
8
+ end
9
+
10
+ def something(name)
11
+ "Something, #{name}"
12
+ end
13
+ end
14
+
15
+ class OCI8AutoRecover < DelegateClass(OCI8)
16
+ def initialize
17
+ @connection = OCI8.new
18
+ super(@connection)
19
+ end
20
+ end
21
+
22
+ class OCI8AutoRecover
23
+ def describe(name)
24
+ @connection.describe(name)
25
+ end
26
+ end
27
+
28
+ describe Kernel do
29
+ it "should not mask a delegate class' describe method" do
30
+ bugger = OCI8AutoRecover.new
31
+ bugger.describe('aslak').should == "Hello, aslak"
32
+ bugger.something('aslak').should == "Something, aslak"
33
+ end
34
+ end
35
+ end
@@ -8,17 +8,30 @@ module Spec
8
8
  @io = StringIO.new
9
9
  @formatter = FailingBehavioursFormatter.new(@io)
10
10
  end
11
+
12
+ def description(s)
13
+ Spec::DSL::Description.new(s)
14
+ end
11
15
 
12
16
  it "should add example name for each failure" do
13
- @formatter.add_behaviour("b 1")
17
+ @formatter.add_behaviour(description("b 1"))
14
18
  @formatter.example_failed("e 1", nil, Reporter::Failure.new(nil, RuntimeError.new))
15
- @formatter.add_behaviour("b 2")
19
+ @formatter.add_behaviour(description("b 2"))
16
20
  @formatter.example_failed("e 2", nil, Reporter::Failure.new(nil, RuntimeError.new))
17
21
  @formatter.example_failed("e 3", nil, Reporter::Failure.new(nil, RuntimeError.new))
18
22
  @io.string.should eql(<<-EOF
19
23
  b 1
20
24
  b 2
21
25
  EOF
26
+ )
27
+ end
28
+
29
+ it "should remove druby url, which is used by Spec::Distributed" do
30
+ @formatter.add_behaviour("something something (druby://99.99.99.99:99)")
31
+ @formatter.example_failed("e 1", nil, Reporter::Failure.new(nil, RuntimeError.new))
32
+ @io.string.should eql(<<-EOF
33
+ something something
34
+ EOF
22
35
  )
23
36
  end
24
37
  end
@@ -11,10 +11,10 @@ module Spec
11
11
 
12
12
  it "should add example name for each failure" do
13
13
  @formatter.add_behaviour("b 1")
14
- @formatter.example_failed("e 1", nil, Reporter::Failure.new(nil, RuntimeError.new))
14
+ @formatter.example_failed(DSL::Example.new("e 1"), nil, Reporter::Failure.new(nil, RuntimeError.new))
15
15
  @formatter.add_behaviour("b 2")
16
- @formatter.example_failed("e 2", nil, Reporter::Failure.new(nil, RuntimeError.new))
17
- @formatter.example_failed("e 3", nil, Reporter::Failure.new(nil, RuntimeError.new))
16
+ @formatter.example_failed(DSL::Example.new("e 2"), nil, Reporter::Failure.new(nil, RuntimeError.new))
17
+ @formatter.example_failed(DSL::Example.new("e 3"), nil, Reporter::Failure.new(nil, RuntimeError.new))
18
18
  @io.string.should eql(<<-EOF
19
19
  b 1 e 1
20
20
  b 2 e 2
@@ -11,7 +11,7 @@ describe "HtmlFormatter" do
11
11
  raise "There should be no absolute paths in html_formatted.html!!" if (expected_html =~ /\/Users/n || expected_html =~ /\/home/n)
12
12
 
13
13
  Dir.chdir(root) do
14
- args = ['failing_examples/mocking_example.rb', 'failing_examples/diffing_spec.rb', 'examples/stubbing_example.rb', 'examples/not_yet_implemented_spec.rb', '--format', 'html', opt]
14
+ args = ['failing_examples/mocking_example.rb', 'failing_examples/diffing_spec.rb', 'examples/stubbing_example.rb', 'examples/pending_example.rb', '--format', 'html', opt]
15
15
  err = StringIO.new
16
16
  out = StringIO.new
17
17
  Spec::Runner::CommandLine.run(
@@ -1,21 +1,20 @@
1
1
  require File.dirname(__FILE__) + '/../../../spec_helper.rb'
2
2
 
3
3
  module Spec
4
- module Runner
5
- module Formatter
6
- describe "ProgressBarFormatterDryRun" do
7
- before(:each) do
8
- @io = StringIO.new
9
- @formatter = ProgressBarFormatter.new(@io)
10
- @formatter.dry_run = true
11
- end
12
- it "should not produce summary on dry run" do
13
- @formatter.dump_summary(3, 2, 1, 0)
14
- @io.string.should eql("")
4
+ module Runner
5
+ module Formatter
6
+ describe ProgressBarFormatter, "dry run" do
7
+ before(:each) do
8
+ @io = StringIO.new
9
+ @formatter = ProgressBarFormatter.new(@io)
10
+ @formatter.dry_run = true
11
+ end
15
12
 
13
+ it "should not produce summary on dry run" do
14
+ @formatter.dump_summary(3, 2, 1, 0)
15
+ @io.string.should eql("")
16
+ end
17
+ end
16
18
  end
17
-
18
- end
19
- end
20
- end
19
+ end
21
20
  end
@@ -7,7 +7,7 @@ module Spec
7
7
  before(:each) do
8
8
  @io = StringIO.new
9
9
  @reporter = Reporter.new([ProgressBarFormatter.new(@io)], NoisyBacktraceTweaker.new)
10
- @reporter.add_behaviour("context")
10
+ @reporter.add_behaviour(Spec::DSL::Description.new("context"))
11
11
  end
12
12
 
13
13
  it "should end with line break" do
@@ -3,7 +3,7 @@ require File.dirname(__FILE__) + '/../../../spec_helper.rb'
3
3
  module Spec
4
4
  module Runner
5
5
  module Formatter
6
- describe "ProgressBarFormatter" do
6
+ describe ProgressBarFormatter do
7
7
  before(:each) do
8
8
  @io = StringIO.new
9
9
  @formatter = ProgressBarFormatter.new(@io)
@@ -14,24 +14,51 @@ module Spec
14
14
  @io.string.should eql("\n")
15
15
  end
16
16
 
17
- it "should produce standard summary without not implemented when not implemented has a 0 count" do
17
+ it "should produce standard summary without pending when pending has a 0 count" do
18
18
  @formatter.dump_summary(3, 2, 1, 0)
19
19
  @io.string.should eql("\nFinished in 3 seconds\n\n2 examples, 1 failure\n")
20
20
  end
21
21
 
22
22
  it "should produce standard summary" do
23
- @formatter.dump_summary(3, 2, 1, 4)
24
- @io.string.should eql("\nFinished in 3 seconds\n\n2 examples, 1 failure, 4 not implemented\n")
23
+ @formatter.example_pending("behaviour", "example", "message")
24
+ @io.rewind
25
+ @formatter.dump_summary(3, 2, 1, 1)
26
+ @io.string.should eql(%Q|
27
+ Finished in 3 seconds
28
+
29
+ 2 examples, 1 failure, 1 pending
30
+
31
+ Pending:
32
+ behaviour example (message)
33
+ |)
34
+ end
35
+
36
+ it "should push green dot for passing spec" do
37
+ @io.should_receive(:tty?).and_return(true)
38
+ @formatter.colour = true
39
+ @formatter.example_passed("spec")
40
+ @io.string.should == "\e[32m.\e[0m"
25
41
  end
26
42
 
27
- it "should push F for failing spec" do
43
+ it "should push red F for failure spec" do
44
+ @io.should_receive(:tty?).and_return(true)
45
+ @formatter.colour = true
46
+ @formatter.example_failed("spec", 98, Reporter::Failure.new("c s", Spec::Expectations::ExpectationNotMetError.new))
47
+ @io.string.should eql("\e[31mF\e[0m")
48
+ end
49
+
50
+ it "should push magenta F for error spec" do
51
+ @io.should_receive(:tty?).and_return(true)
52
+ @formatter.colour = true
28
53
  @formatter.example_failed("spec", 98, Reporter::Failure.new("c s", RuntimeError.new))
29
- @io.string.should eql("F")
54
+ @io.string.should eql("\e[35mF\e[0m")
30
55
  end
31
56
 
32
- it "should push dot for passing spec" do
33
- @formatter.example_passed("spec")
34
- @io.string.should eql(".")
57
+ it "should push blue F for fixed pending spec" do
58
+ @io.should_receive(:tty?).and_return(true)
59
+ @formatter.colour = true
60
+ @formatter.example_failed("spec", 98, Reporter::Failure.new("c s", Spec::DSL::PendingFixedError.new))
61
+ @io.string.should eql("\e[34mF\e[0m")
35
62
  end
36
63
 
37
64
  it "should push nothing on start" do
@@ -54,6 +81,12 @@ EOE
54
81
  /tmp/x.rb:3:
55
82
  EOE
56
83
  end
84
+
85
+ it "should dump pending" do
86
+ @formatter.example_pending("behaviour", "example", "message")
87
+ @formatter.dump_pending
88
+ @io.string.should =~ /Pending\:\nbehaviour example \(message\)\n/
89
+ end
57
90
  end
58
91
 
59
92
  describe "ProgressBarFormatter outputting to custom out" do
@@ -1,46 +1,46 @@
1
1
  require File.dirname(__FILE__) + '/../../../spec_helper.rb'
2
2
 
3
3
  module Spec
4
- module Runner
5
- module Formatter
6
- describe "RdocFormatter" do
7
- before(:each) do
8
- @io = StringIO.new
9
- @formatter = RdocFormatter.new(@io)
10
- @formatter.dry_run = true
11
- end
12
- it "should produce no summary" do
13
- @formatter.dump_summary(nil, nil, nil, nil)
14
- @io.string.should be_empty
15
-
16
- end
17
- it "should produce nothing on start dump" do
18
- @formatter.start_dump
19
- @io.string.should be_empty
20
-
21
- end
22
- it "should push out context" do
23
- @formatter.add_behaviour("context")
24
- @io.string.should eql("# context\n")
25
-
26
- end
27
- it "should push out failed spec" do
28
- @formatter.example_failed("spec", 98, nil)
29
- @io.string.should eql("# * spec [98 - FAILED]\n")
30
-
31
- end
32
- it "should push out spec" do
33
- @formatter.example_passed("spec")
34
- @io.string.should eql("# * spec\n")
35
-
36
- end
4
+ module Runner
5
+ module Formatter
6
+ describe "RdocFormatter" do
7
+ before(:each) do
8
+ @io = StringIO.new
9
+ @formatter = RdocFormatter.new(@io)
10
+ @formatter.dry_run = true
11
+ end
12
+
13
+ it "should produce no summary" do
14
+ @formatter.dump_summary(nil, nil, nil, nil)
15
+ @io.string.should be_empty
16
+ end
17
+
18
+ it "should produce nothing on start dump" do
19
+ @formatter.start_dump
20
+ @io.string.should be_empty
21
+ end
37
22
 
38
- it "should push out not implemented spec" do
39
- @formatter.example_not_implemented("spec")
40
- @io.string.should eql("# * spec [NOT IMPLEMENTED]\n")
23
+ it "should push out context" do
24
+ @formatter.add_behaviour(Spec::DSL::Description.new("context"))
25
+ @io.string.should eql("# context\n")
26
+ end
27
+
28
+ it "should push out failed spec" do
29
+ @formatter.example_failed(DSL::Example.new("spec"), 98, nil)
30
+ @io.string.should eql("# * spec [98 - FAILED]\n")
31
+ end
32
+
33
+ it "should push out spec" do
34
+ @formatter.example_passed(DSL::Example.new("spec"))
35
+ @io.string.should eql("# * spec\n")
36
+ end
37
+
38
+ it "should push out not pending example" do
39
+ @formatter.example_pending("behaviour", "example", "reason")
40
+ @io.string.should eql("# * behaviour example [PENDING: reason]\n")
41
+ end
42
+
43
+ end
41
44
  end
42
-
43
- end
44
- end
45
- end
45
+ end
46
46
  end
@@ -1,56 +1,62 @@
1
1
  require File.dirname(__FILE__) + '/../../../spec_helper.rb'
2
2
 
3
3
  module Spec
4
- module Runner
5
- module Formatter
6
- describe "SpecdocFormatter" do
7
- before(:each) do
8
- @io = StringIO.new
9
- @formatter = SpecdocFormatter.new(@io)
10
- end
4
+ module Runner
5
+ module Formatter
6
+ describe "SpecdocFormatter" do
7
+ before(:each) do
8
+ @io = StringIO.new
9
+ @formatter = SpecdocFormatter.new(@io)
10
+ end
11
11
 
12
- it "should produce standard summary without not implemented when not implemented has a 0 count" do
13
- @formatter.dump_summary(3, 2, 1, 0)
14
- @io.string.should eql("\nFinished in 3 seconds\n\n2 examples, 1 failure\n")
15
- end
12
+ it "should produce standard summary without pending when pending has a 0 count" do
13
+ @formatter.dump_summary(3, 2, 1, 0)
14
+ @io.string.should eql("\nFinished in 3 seconds\n\n2 examples, 1 failure\n")
15
+ end
16
16
 
17
- it "should produce standard summary" do
18
- @formatter.dump_summary(3, 2, 1, 4)
19
- @io.string.should eql("\nFinished in 3 seconds\n\n2 examples, 1 failure, 4 not implemented\n")
20
- end
21
-
22
- it "should push context name" do
23
- @formatter.add_behaviour("context")
24
- @io.string.should eql("\ncontext\n")
25
-
26
- end
27
- it "should push failing spec name and failure number" do
28
- @formatter.example_failed("spec", 98, Reporter::Failure.new("c s", RuntimeError.new))
29
- @io.string.should eql("- spec (ERROR - 98)\n")
30
-
31
- end
32
- it "should push nothing on start" do
33
- @formatter.start(5)
34
- @io.string.should eql("")
35
-
36
- end
37
- it "should push nothing on start dump" do
38
- @formatter.start_dump
39
- @io.string.should eql("")
40
-
41
- end
42
- it "should push passing spec name" do
43
- @formatter.example_passed("spec")
44
- @io.string.should eql("- spec\n")
45
-
46
- end
47
-
48
- it "should push not implemented spec name" do
49
- @formatter.example_not_implemented('spec')
50
- @io.string.should eql("- spec (NOT IMPLEMENTED)\n")
17
+ it "should produce standard summary" do
18
+ @formatter.dump_summary(3, 2, 1, 4)
19
+ @io.string.should eql("\nFinished in 3 seconds\n\n2 examples, 1 failure, 4 pending\n")
20
+ end
21
+
22
+ it "should push context name" do
23
+ @formatter.add_behaviour(Spec::DSL::Description.new("context"))
24
+ @io.string.should eql("\ncontext\n")
25
+ end
26
+
27
+ it "should push failing spec name and failure number" do
28
+ @formatter.example_failed(DSL::Example.new("spec"), 98, Reporter::Failure.new("c s", RuntimeError.new))
29
+ @io.string.should eql("- spec (ERROR - 98)\n")
30
+ end
31
+
32
+ it "should push nothing on start" do
33
+ @formatter.start(5)
34
+ @io.string.should eql("")
35
+ end
36
+
37
+ it "should push nothing on start dump" do
38
+ @formatter.start_dump
39
+ @io.string.should eql("")
40
+ end
41
+
42
+ it "should push passing spec name" do
43
+ @formatter.example_passed(DSL::Example.new("spec"))
44
+ @io.string.should eql("- spec\n")
45
+ end
46
+
47
+ it "should push pending example name and message" do
48
+ @formatter.example_pending('behaviour', 'example','reason')
49
+ @io.string.should eql("- example (PENDING: reason)\n")
50
+ end
51
+
52
+ it "should dump pending" do
53
+ @formatter.example_pending('behaviour', 'example','reason')
54
+ @io.rewind
55
+ @formatter.dump_pending
56
+ @io.string.should =~ /Pending\:\nbehaviour example \(reason\)\n/
57
+ end
58
+
59
+ end
51
60
  end
52
-
53
- end
54
- end
55
- end
61
+ end
56
62
  end
@@ -54,9 +54,9 @@ describe "OptionParser" do
54
54
  @out.read.should match(/Usage: spec \(FILE\|DIRECTORY\|GLOB\)\+ \[options\]/m)
55
55
  end
56
56
 
57
- it "should print instructions about how to fix bad formatter" do
58
- options = parse(["--format", "Custom::BadFormatter"])
59
- @err.string.should match(/Couldn't find formatter class Custom::BadFormatter/n)
57
+ it "should print instructions about how to require missing formatter" do
58
+ lambda { options = parse(["--format", "Custom::MissingFormatter"]) }.should raise_error(NameError)
59
+ @err.string.should match(/Couldn't find formatter class Custom::MissingFormatter/n)
60
60
  end
61
61
 
62
62
  it "should print usage to err if no dir specified" do
@@ -133,7 +133,8 @@ describe "OptionParser" do
133
133
  options = parse(["--format", "html:test.html"])
134
134
  File.should be_exist('test.html')
135
135
  options.formatters[0].class.should equal(Spec::Runner::Formatter::HtmlFormatter)
136
- FileUtils.rm 'test.html' #rescue nil # Help windows
136
+ options.formatters[0].close
137
+ FileUtils.rm 'test.html'
137
138
  end
138
139
 
139
140
  it "should use noisy backtrace tweaker with b option" do
@@ -199,9 +200,9 @@ describe "OptionParser" do
199
200
  options.differ_class.should == Custom::Formatter
200
201
  end
201
202
 
202
- it "should print instructions about how to fix bad differ" do
203
- options = parse(["--diff", "Custom::BadFormatter"])
204
- @err.string.should match(/Couldn't find differ class Custom::BadFormatter/n)
203
+ it "should print instructions about how to fix missing differ" do
204
+ lambda { parse(["--diff", "Custom::MissingFormatter"]) }.should raise_error(NameError)
205
+ @err.string.should match(/Couldn't find differ class Custom::MissingFormatter/n)
205
206
  end
206
207
 
207
208
  it "should support --line to identify spec" do
@@ -293,8 +294,8 @@ describe "OptionParser" do
293
294
  it "should save config to file when --generate-options is specified" do
294
295
  FileUtils.rm 'test.spec.opts' if File.exist?('test.spec.opts')
295
296
  options = parse(["--colour", "--generate-options", "test.spec.opts", "--diff"])
296
- File.open('test.spec.opts').read.should == "--colour\n--diff\n"
297
- FileUtils.rm 'test.spec.opts' #rescue nil # Help windows
297
+ IO.read('test.spec.opts').should == "--colour\n--diff\n"
298
+ FileUtils.rm 'test.spec.opts'
298
299
  end
299
300
 
300
301
  it "should call DrbCommandLine when --drb is specified" do
@@ -322,19 +323,19 @@ describe "OptionParser" do
322
323
  end
323
324
  end
324
325
 
325
- it "should not use a runner by default" do
326
+ it "should use the standard runner by default" do
326
327
  options = parse([])
327
- options.runner_type.should be_nil
328
+ options.create_behaviour_runner.class.should equal(Spec::Runner::BehaviourRunner)
328
329
  end
329
330
 
330
331
  it "should use a custom runner when given" do
331
332
  options = parse(["--runner", "Custom::BehaviourRunner"])
332
- options.runner_type.should equal(Custom::BehaviourRunner)
333
+ options.create_behaviour_runner.class.should equal(Custom::BehaviourRunner)
333
334
  end
334
335
 
335
- it "should fail when custom runner not found" do
336
- parse(["--runner", "whatever"])
337
- @err.string.should match(/Couldn't find behaviour runner class/)
336
+ it "should use a custom runner with extra options" do
337
+ options = parse(["--runner", "Custom::BehaviourRunner:something"])
338
+ options.create_behaviour_runner.class.should equal(Custom::BehaviourRunner)
338
339
  end
339
340
 
340
341
  it "should return the correct default behaviour runner" do