rspec 1.2.0 → 1.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +4 -4
- data/{History.txt → History.rdoc} +27 -4
- data/Manifest.txt +18 -7
- data/{README.txt → README.rdoc} +0 -0
- data/Rakefile +16 -9
- data/{Ruby1.9.markdown → Ruby1.9.rdoc} +3 -3
- data/TODO.txt +0 -7
- data/Upgrade.rdoc +110 -0
- data/features/matchers/create_matcher.feature +40 -0
- data/features/matchers/create_matcher_outside_rspec.feature +39 -0
- data/features/pending/pending_examples.feature +5 -5
- data/features/step_definitions/running_rspec.rb +13 -0
- data/features/subject/explicit_subject.feature +31 -0
- data/features/subject/implicit_subject.feature +31 -0
- data/lib/spec/adapters/mock_frameworks/flexmock.rb +1 -0
- data/lib/spec/adapters/mock_frameworks/mocha.rb +1 -0
- data/lib/spec/adapters/mock_frameworks/rr.rb +1 -0
- data/lib/spec/adapters/mock_frameworks/rspec.rb +12 -10
- data/lib/spec/dsl.rb +0 -1
- data/lib/spec/dsl/main.rb +3 -3
- data/lib/spec/example.rb +4 -3
- data/lib/spec/example/example_group_factory.rb +1 -3
- data/lib/spec/example/example_group_methods.rb +22 -28
- data/lib/spec/example/example_group_proxy.rb +64 -0
- data/lib/spec/example/example_methods.rb +8 -11
- data/lib/spec/example/example_proxy.rb +42 -0
- data/lib/spec/example/shared_example_group.rb +1 -1
- data/lib/spec/example/subject.rb +14 -3
- data/lib/spec/expectations.rb +1 -1
- data/lib/spec/expectations/differs/default.rb +46 -49
- data/lib/spec/expectations/differs/load-diff-lcs.rb +12 -0
- data/lib/spec/interop/test/unit/testcase.rb +2 -2
- data/lib/spec/matchers.rb +49 -9
- data/lib/spec/matchers/be.rb +12 -15
- data/lib/spec/matchers/change.rb +1 -0
- data/lib/spec/matchers/dsl.rb +15 -0
- data/lib/spec/matchers/have.rb +9 -8
- data/lib/spec/matchers/include.rb +2 -16
- data/lib/spec/matchers/match_array.rb +2 -14
- data/lib/spec/matchers/matcher.rb +16 -11
- data/lib/spec/matchers/pretty.rb +36 -0
- data/lib/spec/matchers/raise_error.rb +9 -8
- data/lib/spec/matchers/simple_matcher.rb +1 -0
- data/lib/spec/matchers/throw_symbol.rb +1 -1
- data/lib/spec/mocks/argument_expectation.rb +2 -0
- data/lib/spec/mocks/message_expectation.rb +2 -0
- data/lib/spec/mocks/proxy.rb +9 -10
- data/lib/spec/runner.rb +1 -0
- data/lib/spec/runner/extensions/kernel.rb +9 -0
- data/lib/spec/runner/formatter/base_formatter.rb +22 -9
- data/lib/spec/runner/formatter/html_formatter.rb +2 -1
- data/lib/spec/runner/heckle_runner.rb +1 -0
- data/lib/spec/runner/option_parser.rb +4 -1
- data/lib/spec/runner/options.rb +11 -0
- data/lib/spec/runner/spec_parser.rb +15 -22
- data/lib/spec/version.rb +4 -6
- data/spec/autotest/autotest_helper.rb +6 -1
- data/spec/spec/dsl/main_spec.rb +3 -3
- data/spec/spec/example/example_group_factory_spec.rb +11 -23
- data/spec/spec/example/example_group_methods_spec.rb +45 -20
- data/spec/spec/example/example_group_proxy_spec.rb +63 -0
- data/spec/spec/example/example_group_spec.rb +15 -0
- data/spec/spec/example/example_methods_spec.rb +5 -35
- data/spec/spec/example/example_proxy_spec.rb +47 -0
- data/spec/spec/example/nested_example_group_spec.rb +3 -3
- data/spec/spec/example/shared_example_group_spec.rb +4 -4
- data/spec/spec/example/subject_spec.rb +77 -0
- data/spec/spec/matchers/be_close_spec.rb +10 -10
- data/spec/spec/matchers/be_instance_of_spec.rb +13 -8
- data/spec/spec/matchers/be_kind_of_spec.rb +10 -8
- data/spec/spec/{dsl/matchers_spec.rb → matchers/dsl_spec.rb} +4 -4
- data/spec/spec/matchers/matcher_spec.rb +53 -1
- data/spec/spec/matchers/matchers_spec.rb +2 -0
- data/spec/spec/package/bin_spec_spec.rb +4 -4
- data/spec/spec/runner/command_line_spec.rb +2 -2
- data/spec/spec/runner/formatter/failing_example_groups_formatter_spec.rb +4 -4
- data/spec/spec/runner/formatter/failing_examples_formatter_spec.rb +2 -2
- data/spec/spec/runner/formatter/html_formatted-1.8.4.html +1 -1
- data/spec/spec/runner/formatter/html_formatted-1.8.5-jruby.html +1 -1
- data/spec/spec/runner/formatter/html_formatted-1.8.5.html +1 -1
- data/spec/spec/runner/formatter/html_formatted-1.8.6-jruby.html +1 -1
- data/spec/spec/runner/formatter/html_formatted-1.8.6.html +1 -1
- data/spec/spec/runner/formatter/html_formatted-1.8.7.html +1 -1
- data/spec/spec/runner/formatter/html_formatted-1.9.1.html +1 -1
- data/spec/spec/runner/formatter/nested_text_formatter_spec.rb +12 -11
- data/spec/spec/runner/formatter/profile_formatter_spec.rb +2 -2
- data/spec/spec/runner/formatter/progress_bar_formatter_spec.rb +2 -2
- data/spec/spec/runner/formatter/specdoc_formatter_spec.rb +2 -2
- data/spec/spec/runner/formatter/text_mate_formatted-1.8.4.html +1 -1
- data/spec/spec/runner/formatter/text_mate_formatted-1.8.6.html +1 -1
- data/spec/spec/runner/formatter/text_mate_formatted-1.8.7.html +1 -1
- data/spec/spec/runner/formatter/text_mate_formatted-1.9.1.html +1 -1
- data/spec/spec/runner/option_parser_spec.rb +20 -0
- data/spec/spec/runner/options_spec.rb +23 -1
- data/spec/spec/runner/reporter_spec.rb +20 -17
- data/spec/spec/runner/spec_parser_spec.rb +1 -1
- metadata +33 -15
- data/Upgrade.markdown +0 -63
- data/lib/spec/dsl/matchers.rb +0 -13
- data/lib/spec/example/example_description.rb +0 -15
@@ -6,17 +6,17 @@ describe "The bin/spec script" do
|
|
6
6
|
|
7
7
|
it "should have no warnings" do
|
8
8
|
pending "Hangs on JRuby" if RUBY_PLATFORM =~ /java/
|
9
|
-
|
9
|
+
location = "#{File.dirname(__FILE__)}/../../../bin/spec"
|
10
10
|
|
11
|
-
output = ruby "-w #{
|
11
|
+
output = ruby "-w #{location} --help 2>&1"
|
12
12
|
output.should_not =~ /warning/n
|
13
13
|
end
|
14
14
|
|
15
15
|
it "should show the help w/ no args" do
|
16
16
|
pending "Hangs on JRuby" if RUBY_PLATFORM =~ /java/
|
17
|
-
|
17
|
+
location = "#{File.dirname(__FILE__)}/../../../bin/spec"
|
18
18
|
|
19
|
-
output = ruby "-w #{
|
19
|
+
output = ruby "-w #{location} 2>&1"
|
20
20
|
output.should =~ /^Usage: spec/
|
21
21
|
end
|
22
22
|
end
|
@@ -106,7 +106,7 @@ module Spec
|
|
106
106
|
options.add_example_group(example_group)
|
107
107
|
|
108
108
|
::Spec::Runner::Options.should_receive(:new).with(@err, @out).and_return(options)
|
109
|
-
options.reporter.should_receive(:add_example_group).with(example_group)
|
109
|
+
options.reporter.should_receive(:add_example_group).with(Spec::Example::ExampleGroupProxy.new(example_group))
|
110
110
|
|
111
111
|
Spec::Runner::CommandLine.run(OptionParser.parse([], @err, @out))
|
112
112
|
end
|
@@ -127,7 +127,7 @@ module Spec
|
|
127
127
|
end
|
128
128
|
end
|
129
129
|
|
130
|
-
options.reporter.should_receive(:add_example_group).with(example_group)
|
130
|
+
options.reporter.should_receive(:add_example_group).with(Spec::Example::ExampleGroupProxy.new(example_group))
|
131
131
|
|
132
132
|
options.add_example_group example_group
|
133
133
|
run_with(options)
|
@@ -15,9 +15,9 @@ module Spec
|
|
15
15
|
end
|
16
16
|
|
17
17
|
it "should add example name for each failure" do
|
18
|
-
formatter.add_example_group(Class.new(::Spec::Example::ExampleGroupDouble).describe("b 1"))
|
18
|
+
formatter.add_example_group(Spec::Example::ExampleGroupProxy.new(Class.new(::Spec::Example::ExampleGroupDouble).describe("b 1")))
|
19
19
|
formatter.example_failed("e 1", nil, Spec::Runner::Reporter::Failure.new("g", nil, RuntimeError.new))
|
20
|
-
formatter.add_example_group(Class.new(::Spec::Example::ExampleGroupDouble).describe("b 2"))
|
20
|
+
formatter.add_example_group(Spec::Example::ExampleGroupProxy.new(Class.new(::Spec::Example::ExampleGroupDouble).describe("b 2")))
|
21
21
|
formatter.example_failed("e 2", nil, Spec::Runner::Reporter::Failure.new("g", nil, RuntimeError.new))
|
22
22
|
formatter.example_failed("e 3", nil, Spec::Runner::Reporter::Failure.new("g", nil, RuntimeError.new))
|
23
23
|
io.string.should include("b 1")
|
@@ -29,13 +29,13 @@ module Spec
|
|
29
29
|
child_example_group = Class.new(parent_example_group).describe("#child_method")
|
30
30
|
grand_child_example_group = Class.new(child_example_group).describe("GrandChild")
|
31
31
|
|
32
|
-
formatter.add_example_group(grand_child_example_group)
|
32
|
+
formatter.add_example_group(Spec::Example::ExampleGroupProxy.new(grand_child_example_group))
|
33
33
|
formatter.example_failed("failure", nil, ::Spec::Runner::Reporter::Failure.new("g", nil, RuntimeError.new))
|
34
34
|
io.string.should == "Parent#child_method GrandChild\n"
|
35
35
|
end
|
36
36
|
|
37
37
|
it "should remove druby url, which is used by Spec::Distributed" do
|
38
|
-
@formatter.add_example_group(Class.new(::Spec::Example::ExampleGroupDouble).describe("something something (druby://99.99.99.99:99)"))
|
38
|
+
@formatter.add_example_group(Spec::Example::ExampleGroupProxy.new(Class.new(::Spec::Example::ExampleGroupDouble).describe("something something (druby://99.99.99.99:99)")))
|
39
39
|
@formatter.example_failed("e 1", nil, ::Spec::Runner::Reporter::Failure.new("g", nil, RuntimeError.new))
|
40
40
|
io.string.should == "something something\n"
|
41
41
|
end
|
@@ -15,9 +15,9 @@ module Spec
|
|
15
15
|
example_group_1 = Class.new(::Spec::Example::ExampleGroupDouble).describe("A")
|
16
16
|
example_group_2 = Class.new(example_group_1).describe("B")
|
17
17
|
|
18
|
-
@formatter.add_example_group(example_group_1)
|
18
|
+
@formatter.add_example_group(Spec::Example::ExampleGroupProxy.new(example_group_1))
|
19
19
|
@formatter.example_failed(example_group_1.it("a1"){}, nil, ::Spec::Runner::Reporter::Failure.new("g", nil, RuntimeError.new))
|
20
|
-
@formatter.add_example_group(example_group_2)
|
20
|
+
@formatter.add_example_group(Spec::Example::ExampleGroupProxy.new(example_group_2))
|
21
21
|
@formatter.example_failed(example_group_2.it("b2"){}, nil, ::Spec::Runner::Reporter::Failure.new("g", nil, RuntimeError.new))
|
22
22
|
@formatter.example_failed(example_group_2.it("b3"){}, nil, ::Spec::Runner::Reporter::Failure.new("g", nil, RuntimeError.new))
|
23
23
|
@io.string.should eql(<<-EOF
|
@@ -18,7 +18,7 @@ module Spec
|
|
18
18
|
|
19
19
|
describe "where ExampleGroup has no superclass with a description" do
|
20
20
|
def add_example_group
|
21
|
-
formatter.add_example_group(example_group)
|
21
|
+
formatter.add_example_group(Spec::Example::ExampleGroupProxy.new(example_group))
|
22
22
|
end
|
23
23
|
|
24
24
|
before do
|
@@ -66,7 +66,7 @@ OUT
|
|
66
66
|
|
67
67
|
describe "and parent ExampleGroups have not been printed" do
|
68
68
|
before do
|
69
|
-
formatter.add_example_group(child_example_group)
|
69
|
+
formatter.add_example_group(Spec::Example::ExampleGroupProxy.new(child_example_group))
|
70
70
|
end
|
71
71
|
|
72
72
|
it "should push ExampleGroup name with two spaces of indentation" do
|
@@ -79,9 +79,9 @@ OUT
|
|
79
79
|
|
80
80
|
describe "and parent ExampleGroups have been printed" do
|
81
81
|
before do
|
82
|
-
formatter.add_example_group(example_group)
|
82
|
+
formatter.add_example_group(Spec::Example::ExampleGroupProxy.new(example_group))
|
83
83
|
io.string = ""
|
84
|
-
formatter.add_example_group(child_example_group)
|
84
|
+
formatter.add_example_group(Spec::Example::ExampleGroupProxy.new(child_example_group))
|
85
85
|
end
|
86
86
|
|
87
87
|
it "should print only the indented ExampleGroup" do
|
@@ -101,7 +101,8 @@ OUT
|
|
101
101
|
|
102
102
|
describe "and parent ExampleGroups have not been printed" do
|
103
103
|
before do
|
104
|
-
formatter.add_example_group(grand_child_example_group)
|
104
|
+
formatter.add_example_group(Spec::Example::ExampleGroupProxy.new(grand_child_example_group))
|
105
|
+
|
105
106
|
end
|
106
107
|
|
107
108
|
it "should print the entire nested ExampleGroup heirarchy" do
|
@@ -115,9 +116,9 @@ OUT
|
|
115
116
|
|
116
117
|
describe "and parent ExampleGroups have been printed" do
|
117
118
|
before do
|
118
|
-
formatter.add_example_group(child_example_group)
|
119
|
+
formatter.add_example_group(Spec::Example::ExampleGroupProxy.new(child_example_group))
|
119
120
|
io.string = ""
|
120
|
-
formatter.add_example_group(grand_child_example_group)
|
121
|
+
formatter.add_example_group(Spec::Example::ExampleGroupProxy.new(grand_child_example_group))
|
121
122
|
end
|
122
123
|
|
123
124
|
it "should print only the indented ExampleGroup" do
|
@@ -135,7 +136,7 @@ OUT
|
|
135
136
|
describe "and parent ExampleGroups have not been printed" do
|
136
137
|
def add_example_group
|
137
138
|
@child_example_group = Class.new(example_group)
|
138
|
-
formatter.add_example_group(child_example_group)
|
139
|
+
formatter.add_example_group(Spec::Example::ExampleGroupProxy.new(child_example_group))
|
139
140
|
end
|
140
141
|
|
141
142
|
it "should render only the parent ExampleGroup" do
|
@@ -148,9 +149,9 @@ OUT
|
|
148
149
|
describe "and parent ExampleGroups have been printed" do
|
149
150
|
def add_example_group
|
150
151
|
@child_example_group = Class.new(example_group)
|
151
|
-
formatter.add_example_group(example_group)
|
152
|
+
formatter.add_example_group(Spec::Example::ExampleGroupProxy.new(example_group))
|
152
153
|
io.string = ""
|
153
|
-
formatter.add_example_group(child_example_group)
|
154
|
+
formatter.add_example_group(Spec::Example::ExampleGroupProxy.new(child_example_group))
|
154
155
|
end
|
155
156
|
|
156
157
|
it "should not render anything" do
|
@@ -208,7 +209,7 @@ OUT
|
|
208
209
|
def add_example_group
|
209
210
|
@child_example_group = Class.new(example_group).describe("Child ExampleGroup")
|
210
211
|
@grand_child_example_group = Class.new(child_example_group).describe("GrandChild ExampleGroup")
|
211
|
-
formatter.add_example_group(grand_child_example_group)
|
212
|
+
formatter.add_example_group(Spec::Example::ExampleGroupProxy.new(grand_child_example_group))
|
212
213
|
end
|
213
214
|
|
214
215
|
describe "when having an error" do
|
@@ -32,7 +32,7 @@ module Spec
|
|
32
32
|
parent_example_group = Class.new(::Spec::Example::ExampleGroupDouble).describe('Parent')
|
33
33
|
child_example_group = Class.new(parent_example_group).describe('Child')
|
34
34
|
|
35
|
-
formatter.add_example_group(child_example_group)
|
35
|
+
formatter.add_example_group(Spec::Example::ExampleGroupProxy.new(child_example_group))
|
36
36
|
|
37
37
|
formatter.example_started('when foo')
|
38
38
|
Time.stub!(:now).and_return(now+1)
|
@@ -50,7 +50,7 @@ module Spec
|
|
50
50
|
|
51
51
|
it "should print the top 10 results" do
|
52
52
|
example_group = Class.new(::Spec::Example::ExampleGroup).describe("ExampleGroup")
|
53
|
-
formatter.add_example_group(example_group)
|
53
|
+
formatter.add_example_group(Spec::Example::ExampleGroupProxy.new(example_group))
|
54
54
|
formatter.instance_variable_set("@time", Time.now)
|
55
55
|
|
56
56
|
15.times do
|
@@ -30,7 +30,7 @@ module Spec
|
|
30
30
|
end
|
31
31
|
end
|
32
32
|
example = example_group.examples.first
|
33
|
-
@formatter.add_example_group(example_group)
|
33
|
+
@formatter.add_example_group(Spec::Example::ExampleGroupProxy.new(example_group))
|
34
34
|
@formatter.example_pending(example, "message", "#{__FILE__}:#{__LINE__}")
|
35
35
|
@io.rewind
|
36
36
|
@formatter.dump_summary(3, 2, 1, 1)
|
@@ -98,7 +98,7 @@ EOE
|
|
98
98
|
example = example_group.examples.first
|
99
99
|
file = __FILE__
|
100
100
|
line = __LINE__ + 2
|
101
|
-
@formatter.add_example_group(example_group)
|
101
|
+
@formatter.add_example_group(Spec::Example::ExampleGroupProxy.new(example_group))
|
102
102
|
@formatter.example_pending(example, "message", "#{__FILE__}:#{__LINE__}")
|
103
103
|
@formatter.dump_pending
|
104
104
|
@io.string.should ==(<<-HERE)
|
@@ -24,7 +24,7 @@ module Spec
|
|
24
24
|
end
|
25
25
|
|
26
26
|
def add_example_group
|
27
|
-
formatter.add_example_group(example_group)
|
27
|
+
formatter.add_example_group(Spec::Example::ExampleGroupProxy.new(example_group))
|
28
28
|
end
|
29
29
|
|
30
30
|
describe "#dump_summary" do
|
@@ -76,7 +76,7 @@ module Spec
|
|
76
76
|
def add_example_group
|
77
77
|
@child_example_group = Class.new(example_group).describe("Child ExampleGroup")
|
78
78
|
@grand_child_example_group = Class.new(child_example_group).describe("GrandChild ExampleGroup")
|
79
|
-
formatter.add_example_group(grand_child_example_group)
|
79
|
+
formatter.add_example_group(Spec::Example::ExampleGroupProxy.new(grand_child_example_group))
|
80
80
|
end
|
81
81
|
|
82
82
|
describe "when having an error" do
|
@@ -24,6 +24,26 @@ describe "OptionParser" do
|
|
24
24
|
options.filename_pattern.should == "foo"
|
25
25
|
end
|
26
26
|
|
27
|
+
it "should accept debugger option" do
|
28
|
+
options = parse(["--debugger"])
|
29
|
+
options.debug.should be_true
|
30
|
+
end
|
31
|
+
|
32
|
+
it "should accept -u form of debugger option" do
|
33
|
+
options = parse(["-u"])
|
34
|
+
options.debug.should be_true
|
35
|
+
end
|
36
|
+
|
37
|
+
it "should turn off the debugger option if drb is specified later" do
|
38
|
+
options = parse(["-u", "--drb"])
|
39
|
+
options.debug.should_not be_true
|
40
|
+
end
|
41
|
+
|
42
|
+
it "should turn off the debugger option if drb is specified first" do
|
43
|
+
options = parse(["--drb", "-u"])
|
44
|
+
options.debug.should_not be_true
|
45
|
+
end
|
46
|
+
|
27
47
|
it "should accept dry run option" do
|
28
48
|
options = parse(["--dry-run"])
|
29
49
|
options.dry_run.should be_true
|
@@ -106,6 +106,12 @@ module Spec
|
|
106
106
|
@options.dry_run.should == false
|
107
107
|
end
|
108
108
|
end
|
109
|
+
|
110
|
+
describe "#debug" do
|
111
|
+
it "should default to false" do
|
112
|
+
@options.debug.should == false
|
113
|
+
end
|
114
|
+
end
|
109
115
|
|
110
116
|
describe "#context_lines" do
|
111
117
|
it "should default to 3" do
|
@@ -215,6 +221,22 @@ module Spec
|
|
215
221
|
end
|
216
222
|
end
|
217
223
|
|
224
|
+
describe "debug option specified" do
|
225
|
+
it "should cause ruby_debug to be required and do nothing" do
|
226
|
+
@options.debug = true
|
227
|
+
@options.should_receive(:require_ruby_debug)
|
228
|
+
@options.run_examples.should be_true
|
229
|
+
end
|
230
|
+
end
|
231
|
+
|
232
|
+
describe "debug option not specified" do
|
233
|
+
it "should not cause ruby_debug to be required" do
|
234
|
+
@options.debug = false
|
235
|
+
@options.should_not_receive(:require_ruby_debug)
|
236
|
+
@options.run_examples.should be_true
|
237
|
+
end
|
238
|
+
end
|
239
|
+
|
218
240
|
describe "#load_class" do
|
219
241
|
it "should raise error when not class name" do
|
220
242
|
lambda do
|
@@ -316,7 +338,7 @@ module Spec
|
|
316
338
|
it "defines global predicate matcher methods on ExampleMethods" do
|
317
339
|
Spec::Runner.configuration.stub!(:predicate_matchers).and_return({:this => :that?})
|
318
340
|
group = Class.new(::Spec::Example::ExampleGroupDouble).describe("Some Examples")
|
319
|
-
example = group.new(
|
341
|
+
example = group.new(::Spec::Example::ExampleProxy.new)
|
320
342
|
|
321
343
|
@options.run_examples
|
322
344
|
example.this
|
@@ -3,7 +3,7 @@ require File.dirname(__FILE__) + '/../../spec_helper.rb'
|
|
3
3
|
module Spec
|
4
4
|
module Runner
|
5
5
|
describe Reporter do
|
6
|
-
attr_reader :formatter_output, :options, :backtrace_tweaker, :formatter, :reporter, :example_group
|
6
|
+
attr_reader :formatter_output, :options, :backtrace_tweaker, :formatter, :reporter, :example_group, :example_group_proxy, :example_proxy
|
7
7
|
before(:each) do
|
8
8
|
@formatter_output = StringIO.new
|
9
9
|
@options = Options.new(StringIO.new, StringIO.new)
|
@@ -13,6 +13,8 @@ module Spec
|
|
13
13
|
options.formatters << formatter
|
14
14
|
@reporter = Reporter.new(options)
|
15
15
|
@example_group = create_example_group("example_group")
|
16
|
+
@example_group_proxy = Spec::Example::ExampleGroupProxy.new(@example_group)
|
17
|
+
@example_proxy = Spec::Example::ExampleProxy.new
|
16
18
|
example_group.notify(reporter)
|
17
19
|
end
|
18
20
|
|
@@ -33,7 +35,7 @@ module Spec
|
|
33
35
|
end
|
34
36
|
|
35
37
|
it "should tell formatter when example_group is added" do
|
36
|
-
formatter.should_receive(:add_example_group).with(
|
38
|
+
formatter.should_receive(:add_example_group).with(example_group_proxy)
|
37
39
|
example_group.notify(reporter)
|
38
40
|
end
|
39
41
|
|
@@ -58,13 +60,13 @@ module Spec
|
|
58
60
|
end
|
59
61
|
|
60
62
|
def description_of(example)
|
61
|
-
::Spec::Example::
|
63
|
+
::Spec::Example::ExampleProxy.new(String === example ? example : example.description)
|
62
64
|
end
|
63
65
|
|
64
66
|
it "should handle multiple examples with the same name" do
|
65
67
|
error=RuntimeError.new
|
66
|
-
passing = ::Spec::Example::ExampleGroupDouble.new(
|
67
|
-
failing = ::Spec::Example::ExampleGroupDouble.new(
|
68
|
+
passing = ::Spec::Example::ExampleGroupDouble.new(example_proxy)
|
69
|
+
failing = ::Spec::Example::ExampleGroupDouble.new(example_proxy)
|
68
70
|
|
69
71
|
formatter.should_receive(:add_example_group).exactly(2).times
|
70
72
|
formatter.should_receive(:example_passed).with(description_of(passing)).exactly(2).times
|
@@ -141,11 +143,11 @@ module Spec
|
|
141
143
|
it "should delegate to backtrace tweaker" do
|
142
144
|
formatter.should_receive(:example_failed)
|
143
145
|
backtrace_tweaker.should_receive(:tweak_backtrace)
|
144
|
-
reporter.example_finished(
|
146
|
+
reporter.example_finished(example_proxy, RuntimeError.new)
|
145
147
|
end
|
146
148
|
|
147
149
|
it "should account for failing example in stats" do
|
148
|
-
example = ::Spec::Example::ExampleGroupDouble.new(
|
150
|
+
example = ::Spec::Example::ExampleGroupDouble.new(example_proxy)
|
149
151
|
formatter.should_receive(:example_failed).with(description_of(example), 1, failure)
|
150
152
|
formatter.should_receive(:start_dump)
|
151
153
|
formatter.should_receive(:dump_pending)
|
@@ -165,21 +167,21 @@ module Spec
|
|
165
167
|
end
|
166
168
|
|
167
169
|
it "should tell formatter example is pending" do
|
168
|
-
example = ExampleGroup.new(
|
170
|
+
example = ExampleGroup.new(example_proxy)
|
169
171
|
formatter.should_receive(:example_pending).with(description_of(example), "reason", @pending_caller)
|
170
|
-
formatter.should_receive(:add_example_group).with(
|
172
|
+
formatter.should_receive(:add_example_group).with(example_group_proxy)
|
171
173
|
example_group.notify(reporter)
|
172
174
|
reporter.example_finished(description_of(example), @pending_error)
|
173
175
|
end
|
174
176
|
|
175
177
|
it "should account for pending example in stats" do
|
176
|
-
example = ExampleGroup.new(
|
178
|
+
example = ExampleGroup.new(example_proxy)
|
177
179
|
formatter.should_receive(:example_pending).with(description_of(example), "reason", @pending_caller)
|
178
180
|
formatter.should_receive(:start_dump)
|
179
181
|
formatter.should_receive(:dump_pending)
|
180
182
|
formatter.should_receive(:dump_summary).with(anything(), 1, 0, 1)
|
181
183
|
formatter.should_receive(:close).with(no_args)
|
182
|
-
formatter.should_receive(:add_example_group).with(
|
184
|
+
formatter.should_receive(:add_example_group).with(example_group_proxy)
|
183
185
|
example_group.notify(reporter)
|
184
186
|
reporter.example_finished(description_of(example), @pending_error)
|
185
187
|
reporter.dump
|
@@ -201,16 +203,17 @@ module Spec
|
|
201
203
|
options.formatters << @deprecated_formatter
|
202
204
|
end
|
203
205
|
|
204
|
-
it "should pass the correct example to the formatter" do
|
205
|
-
|
206
|
+
it "should pass the correct example description to the formatter" do
|
207
|
+
description = Spec::Example::ExampleProxy.new("name")
|
208
|
+
example = ExampleGroup.new(description)
|
206
209
|
example_group.notify(reporter)
|
207
210
|
reporter.example_finished(description_of(example), @pending_error)
|
208
211
|
|
209
|
-
@deprecated_formatter.example_passed_to_method.should ==
|
212
|
+
@deprecated_formatter.example_passed_to_method.should == description
|
210
213
|
end
|
211
214
|
|
212
215
|
it "should pass the correct pending error message to the formatter" do
|
213
|
-
example = ExampleGroup.new(
|
216
|
+
example = ExampleGroup.new(example_proxy)
|
214
217
|
example_group.notify(reporter)
|
215
218
|
reporter.example_finished(description_of(example), @pending_error)
|
216
219
|
|
@@ -220,7 +223,7 @@ module Spec
|
|
220
223
|
it "should raise a deprecation warning" do
|
221
224
|
Kernel.should_receive(:warn).with(Spec::Runner::Reporter::EXAMPLE_PENDING_DEPRECATION_WARNING)
|
222
225
|
|
223
|
-
example = ExampleGroup.new(
|
226
|
+
example = ExampleGroup.new(example_proxy)
|
224
227
|
example_group.notify(reporter)
|
225
228
|
reporter.example_finished(description_of(example), @pending_error)
|
226
229
|
end
|
@@ -232,7 +235,7 @@ module Spec
|
|
232
235
|
formatter.should_receive(:example_failed) do |name, counter, failure|
|
233
236
|
failure.header.should == "'example_group should do something' FIXED"
|
234
237
|
end
|
235
|
-
formatter.should_receive(:add_example_group).with(
|
238
|
+
formatter.should_receive(:add_example_group).with(example_group_proxy)
|
236
239
|
example_group.notify(reporter)
|
237
240
|
reporter.example_finished(description_of(example_group.examples.first), Spec::Example::PendingExampleFixedError.new("reason"))
|
238
241
|
end
|