ci_reporter 1.0 → 1.6.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,230 @@
1
+ # Copyright (c) 2006-2010 Nick Sieger <nicksieger@gmail.com>
2
+ # See the file LICENSE.txt included with the distribution for
3
+ # software license details.
4
+
5
+ require File.dirname(__FILE__) + "/../../spec_helper.rb"
6
+ require 'ci/reporter/cucumber'
7
+
8
+ describe "The Cucumber reporter" do
9
+ describe CI::Reporter::CucumberFailure do
10
+ before(:each) do
11
+ @klass = mock("class")
12
+ @klass.stub!(:name).and_return("Exception name")
13
+
14
+ @exception = mock("exception")
15
+ @exception.stub!(:class).and_return(@klass)
16
+ @exception.stub!(:message).and_return("Exception message")
17
+ @exception.stub!(:backtrace).and_return(["First line", "Second line"])
18
+
19
+ @step = mock("step")
20
+ @step.stub!(:exception).and_return(@exception)
21
+
22
+ @cucumber_failure = CI::Reporter::CucumberFailure.new(@step)
23
+ end
24
+
25
+ it "should always return true for failure?" do
26
+ @cucumber_failure.should be_failure
27
+ end
28
+
29
+ it "should always return false for error?" do
30
+ @cucumber_failure.should_not be_error
31
+ end
32
+
33
+ it "should propagate the name as the underlying exception's class name" do
34
+ @step.should_receive(:exception)
35
+ @exception.should_receive(:class)
36
+ @klass.should_receive(:name)
37
+
38
+ @cucumber_failure.name.should == "Exception name"
39
+ end
40
+
41
+ it "should propagate the message as the underlying exception's message" do
42
+ @step.should_receive(:exception)
43
+ @exception.should_receive(:message)
44
+
45
+ @cucumber_failure.message.should == "Exception message"
46
+ end
47
+
48
+ it "should propagate and format the exception's backtrace" do
49
+ @step.should_receive(:exception)
50
+ @exception.should_receive(:backtrace)
51
+
52
+ @cucumber_failure.location.should == "First line\nSecond line"
53
+ end
54
+ end
55
+
56
+ describe CI::Reporter::Cucumber do
57
+ before(:each) do
58
+ @step_mother = mock("step_mother")
59
+ @io = mock("io")
60
+
61
+ @report_manager = mock("report_manager")
62
+ CI::Reporter::ReportManager.stub!(:new).and_return(@report_manager)
63
+ end
64
+
65
+ def new_instance
66
+ CI::Reporter::Cucumber.new(@step_mother, @io, {})
67
+ end
68
+
69
+ it "should create a new report manager to report on test success/failure" do
70
+ CI::Reporter::ReportManager.should_receive(:new)
71
+ new_instance
72
+ end
73
+
74
+ it "should record the feature name when a new feature is visited" do
75
+ cucumber = new_instance
76
+ cucumber.feature_name(nil, "Some feature name")
77
+ cucumber.name.should == "Some feature name"
78
+ end
79
+
80
+ it "should record only the first line of a feature name" do
81
+ cucumber = new_instance
82
+ cucumber.feature_name(nil, "Some feature name\nLonger description")
83
+ cucumber.name.should == "Some feature name"
84
+ end
85
+
86
+ context "applied to a feature" do
87
+ before(:each) do
88
+ @cucumber = new_instance
89
+ @cucumber.feature_name(nil, "Demo feature")
90
+
91
+ @test_suite = mock("test_suite", :start => nil, :finish => nil, :name= => nil)
92
+ CI::Reporter::TestSuite.stub!(:new).and_return(@test_suite)
93
+
94
+ @feature = mock("feature")
95
+
96
+ @report_manager.stub!(:write_report)
97
+ end
98
+
99
+ context "before" do
100
+ it "should create a new test suite" do
101
+ CI::Reporter::TestSuite.should_receive(:new).with(/Demo feature/)
102
+ @cucumber.before_feature(@feature)
103
+ end
104
+
105
+ it "should indicate that the test suite has started" do
106
+ @test_suite.should_receive(:start)
107
+ @cucumber.before_feature(@feature)
108
+ end
109
+ end
110
+
111
+ context "after" do
112
+ before :each do
113
+ @cucumber = new_instance
114
+ @cucumber.feature_name(nil, "Demo feature")
115
+
116
+ @test_suite = mock("test_suite", :start => nil, :finish => nil, :name= => nil)
117
+ CI::Reporter::TestSuite.stub!(:new).and_return(@test_suite)
118
+
119
+ @feature = mock("feature")
120
+
121
+ @report_manager.stub!(:write_report)
122
+
123
+ @cucumber.before_feature(@feature)
124
+ end
125
+
126
+ it "should indicate that the test suite has finished" do
127
+ @test_suite.should_receive(:finish)
128
+ @cucumber.after_feature(@feature)
129
+ end
130
+
131
+ it "should ask the report manager to write a report" do
132
+ @report_manager.should_receive(:write_report).with(@test_suite)
133
+ @cucumber.after_feature(@feature)
134
+ end
135
+ end
136
+ end
137
+
138
+ context "inside a scenario" do
139
+ before(:each) do
140
+ @testcases = []
141
+
142
+ @test_suite = mock("test_suite", :testcases => @testcases)
143
+
144
+ @cucumber = new_instance
145
+ @cucumber.stub!(:test_suite).and_return(@test_suite)
146
+
147
+ @test_case = mock("test_case", :start => nil, :finish => nil, :name => "Step Name")
148
+ CI::Reporter::TestCase.stub!(:new).and_return(@test_case)
149
+
150
+ @step = mock("step", :status => :passed)
151
+ @step.stub!(:name).and_return("Step Name")
152
+ end
153
+
154
+ context "before steps" do
155
+ it "should create a new test case" do
156
+ CI::Reporter::TestCase.should_receive(:new).with("Step Name")
157
+ @cucumber.scenario_name(nil, "Step Name")
158
+ @cucumber.before_steps(@step)
159
+ end
160
+
161
+ it "should indicate that the test case has started" do
162
+ @test_case.should_receive(:start)
163
+ @cucumber.before_steps(@step)
164
+ end
165
+ end
166
+
167
+ context "after steps" do
168
+ before :each do
169
+ @cucumber.before_steps(@step)
170
+ end
171
+
172
+ it "should indicate that the test case has finished" do
173
+ @test_case.should_receive(:finish)
174
+ @cucumber.after_steps(@step)
175
+ end
176
+
177
+ it "should add the test case to the suite's list of cases" do
178
+ @testcases.should be_empty
179
+ @cucumber.after_steps(@step)
180
+ @testcases.should_not be_empty
181
+ @testcases.first.should == @test_case
182
+ end
183
+
184
+ it "should alter the name of a test case that is pending to include '(PENDING)'" do
185
+ @step.stub!(:status).and_return(:pending)
186
+ @test_case.should_receive(:name=).with("Step Name (PENDING)")
187
+ @cucumber.after_steps(@step)
188
+ end
189
+
190
+ it "should alter the name of a test case that is undefined to include '(PENDING)'" do
191
+ @step.stub!(:status).and_return(:undefined)
192
+ @test_case.should_receive(:name=).with("Step Name (PENDING)")
193
+ @cucumber.after_steps(@step)
194
+ end
195
+
196
+ it "should alter the name of a test case that was skipped to include '(SKIPPED)'" do
197
+ @step.stub!(:status).and_return(:skipped)
198
+ @test_case.should_receive(:name=).with("Step Name (SKIPPED)")
199
+ @cucumber.after_steps(@step)
200
+ end
201
+ end
202
+
203
+ describe "that fails" do
204
+ before(:each) do
205
+ @step.stub!(:status).and_return(:failed)
206
+
207
+ @failures = []
208
+ @test_case.stub!(:failures).and_return(@failures)
209
+
210
+ @cucumber.before_steps(@step)
211
+
212
+ @cucumber_failure = mock("cucumber_failure")
213
+ CI::Reporter::CucumberFailure.stub!(:new).and_return(@cucumber_failure)
214
+ end
215
+
216
+ it "should create a new cucumber failure with that step" do
217
+ CI::Reporter::CucumberFailure.should_receive(:new).with(@step)
218
+ @cucumber.after_steps(@step)
219
+ end
220
+
221
+ it "should add the failure to the suite's list of failures" do
222
+ @failures.should be_empty
223
+ @cucumber.after_steps(@step)
224
+ @failures.should_not be_empty
225
+ @failures.first.should == @cucumber_failure
226
+ end
227
+ end
228
+ end
229
+ end
230
+ end
@@ -0,0 +1,57 @@
1
+ # Copyright (c) 2006-2010 Nick Sieger <nicksieger@gmail.com>
2
+ # See the file LICENSE.txt included with the distribution for
3
+ # software license details.
4
+
5
+ require File.dirname(__FILE__) + "/../../spec_helper.rb"
6
+ require 'rexml/document'
7
+
8
+ describe "Output capture" do
9
+ before(:each) do
10
+ @suite = CI::Reporter::TestSuite.new "test"
11
+ end
12
+
13
+ it "should save stdout and stderr messages written during the test run" do
14
+ @suite.start
15
+ puts "Hello"
16
+ $stderr.print "Hi"
17
+ @suite.finish
18
+ @suite.stdout.should == "Hello\n"
19
+ @suite.stderr.should == "Hi"
20
+ end
21
+
22
+ it "should include system-out and system-err elements in the xml output" do
23
+ @suite.start
24
+ puts "Hello"
25
+ $stderr.print "Hi"
26
+ @suite.finish
27
+
28
+ root = REXML::Document.new(@suite.to_xml).root
29
+ root.elements.to_a('//system-out').length.should == 1
30
+ root.elements.to_a('//system-err').length.should == 1
31
+ root.elements.to_a('//system-out').first.texts.first.to_s.strip.should == "Hello"
32
+ root.elements.to_a('//system-err').first.texts.first.to_s.strip.should == "Hi"
33
+ end
34
+
35
+ it "should return $stdout and $stderr to original value after finish" do
36
+ out, err = $stdout, $stderr
37
+ @suite.start
38
+ $stdout.object_id.should_not == out.object_id
39
+ $stderr.object_id.should_not == err.object_id
40
+ @suite.finish
41
+ $stdout.object_id.should == out.object_id
42
+ $stderr.object_id.should == err.object_id
43
+ end
44
+
45
+ it "should capture only during run of owner test suite" do
46
+ $stdout.print "A"
47
+ $stderr.print "A"
48
+ @suite.start
49
+ $stdout.print "B"
50
+ $stderr.print "B"
51
+ @suite.finish
52
+ $stdout.print "C"
53
+ $stderr.print "C"
54
+ @suite.stdout.should == "B"
55
+ @suite.stderr.should == "B"
56
+ end
57
+ end
@@ -0,0 +1,100 @@
1
+ # Copyright (c) 2006-2010 Nick Sieger <nicksieger@gmail.com>
2
+ # See the file LICENSE.txt included with the distribution for
3
+ # software license details.
4
+
5
+ require File.dirname(__FILE__) + "/../../../spec_helper.rb"
6
+ require 'rake'
7
+
8
+ def save_env(v)
9
+ ENV["PREV_#{v}"] = ENV[v]
10
+ end
11
+ def restore_env(v)
12
+ ENV[v] = ENV["PREV_#{v}"]
13
+ ENV.delete("PREV_#{v}")
14
+ end
15
+
16
+ describe "ci_reporter ci:setup:testunit task" do
17
+ before(:each) do
18
+ @rake = Rake::Application.new
19
+ Rake.application = @rake
20
+ load CI_REPORTER_LIB + '/ci/reporter/rake/test_unit.rb'
21
+ save_env "CI_REPORTS"
22
+ save_env "TESTOPTS"
23
+ ENV["CI_REPORTS"] = "some-bogus-nonexistent-directory-that-wont-fail-rm_rf"
24
+ end
25
+ after(:each) do
26
+ restore_env "TESTOPTS"
27
+ restore_env "CI_REPORTS"
28
+ Rake.application = nil
29
+ end
30
+
31
+ it "should set ENV['TESTOPTS'] to include test/unit setup file" do
32
+ @rake["ci:setup:testunit"].invoke
33
+ ENV["TESTOPTS"].should =~ /test_unit_loader/
34
+ end
35
+
36
+ it "should append to ENV['TESTOPTS'] if it already contains a value" do
37
+ ENV["TESTOPTS"] = "somevalue".freeze
38
+ @rake["ci:setup:testunit"].invoke
39
+ ENV["TESTOPTS"].should =~ /somevalue.*test_unit_loader/
40
+ end
41
+ end
42
+
43
+ describe "ci_reporter ci:setup:rspec task" do
44
+ before(:each) do
45
+ @rake = Rake::Application.new
46
+ Rake.application = @rake
47
+ load CI_REPORTER_LIB + '/ci/reporter/rake/rspec.rb'
48
+ save_env "CI_REPORTS"
49
+ save_env "SPEC_OPTS"
50
+ ENV["CI_REPORTS"] = "some-bogus-nonexistent-directory-that-wont-fail-rm_rf"
51
+ end
52
+ after(:each) do
53
+ restore_env "SPEC_OPTS"
54
+ restore_env "CI_REPORTS"
55
+ Rake.application = nil
56
+ end
57
+
58
+ it "should set ENV['SPEC_OPTS'] to include rspec formatter args" do
59
+ @rake["ci:setup:rspec"].invoke
60
+ ENV["SPEC_OPTS"].should =~ /--require.*rspec_loader.*--format.*CI::Reporter::RSpec/
61
+ end
62
+
63
+ it "should set ENV['SPEC_OPTS'] to include rspec doc formatter if task is ci:setup:rspecdoc" do
64
+ @rake["ci:setup:rspecdoc"].invoke
65
+ ENV["SPEC_OPTS"].should =~ /--require.*rspec_loader.*--format.*CI::Reporter::RSpecDoc/
66
+ end
67
+
68
+ it "should append to ENV['SPEC_OPTS'] if it already contains a value" do
69
+ ENV["SPEC_OPTS"] = "somevalue".freeze
70
+ @rake["ci:setup:rspec"].invoke
71
+ ENV["SPEC_OPTS"].should =~ /somevalue.*--require.*rspec_loader.*--format.*CI::Reporter::RSpec/
72
+ end
73
+ end
74
+
75
+ describe "ci_reporter ci:setup:cucumber task" do
76
+ before(:each) do
77
+ @rake = Rake::Application.new
78
+ Rake.application = @rake
79
+ load CI_REPORTER_LIB + '/ci/reporter/rake/cucumber.rb'
80
+ save_env "CI_REPORTS"
81
+ save_env "CUCUMBER_OPTS"
82
+ ENV["CI_REPORTS"] = "some-bogus-nonexistent-directory-that-wont-fail-rm_rf"
83
+ end
84
+ after(:each) do
85
+ restore_env "CUCUMBER_OPTS"
86
+ restore_env "CI_REPORTS"
87
+ Rake.application = nil
88
+ end
89
+
90
+ it "should set ENV['CUCUMBER_OPTS'] to include cucumber formatter args" do
91
+ @rake["ci:setup:cucumber"].invoke
92
+ ENV["CUCUMBER_OPTS"].should =~ /--require.*cucumber_loader.*--format.*CI::Reporter::Cucumber/
93
+ end
94
+
95
+ it "should append to ENV['CUCUMBER_OPTS'] if it already contains a value" do
96
+ ENV["CUCUMBER_OPTS"] = "somevalue".freeze
97
+ @rake["ci:setup:cucumber"].invoke
98
+ ENV["CUCUMBER_OPTS"].should =~ /somevalue.*--require.*cucumber_loader.*--format.*CI::Reporter::Cucumber/
99
+ end
100
+ end
@@ -1,35 +1,39 @@
1
+ # Copyright (c) 2006-2010 Nick Sieger <nicksieger@gmail.com>
2
+ # See the file LICENSE.txt included with the distribution for
3
+ # software license details.
4
+
1
5
  require File.dirname(__FILE__) + "/../../spec_helper.rb"
2
6
 
3
- context "The ReportManager" do
4
- setup do
7
+ describe "The ReportManager" do
8
+ before(:each) do
5
9
  @reports_dir = REPORTS_DIR
6
10
  end
7
11
 
8
- teardown do
12
+ after(:each) do
9
13
  FileUtils.rm_rf @reports_dir
10
14
  ENV["CI_REPORTS"] = nil
11
15
  end
12
16
 
13
- specify "should create the report directory according to the given prefix" do
17
+ it "should create the report directory according to the given prefix" do
14
18
  CI::Reporter::ReportManager.new("spec")
15
- File.directory?(@reports_dir).should_be true
19
+ File.directory?(@reports_dir).should be_true
16
20
  end
17
21
 
18
- specify "should create the report directory based on CI_REPORTS environment variable if set" do
22
+ it "should create the report directory based on CI_REPORTS environment variable if set" do
19
23
  @reports_dir = "#{Dir.getwd}/dummy"
20
24
  ENV["CI_REPORTS"] = @reports_dir
21
25
  CI::Reporter::ReportManager.new("spec")
22
- File.directory?(@reports_dir).should_be true
26
+ File.directory?(@reports_dir).should be_true
23
27
  end
24
28
 
25
- specify "should write reports based on name and xml content of a test suite" do
29
+ it "should write reports based on name and xml content of a test suite" do
26
30
  reporter = CI::Reporter::ReportManager.new("spec")
27
31
  suite = mock("test suite")
28
32
  suite.should_receive(:name).and_return("some test suite name")
29
33
  suite.should_receive(:to_xml).and_return("<xml></xml>")
30
34
  reporter.write_report(suite)
31
35
  filename = "#{REPORTS_DIR}/SPEC-some-test-suite-name.xml"
32
- File.exist?(filename).should_be true
36
+ File.exist?(filename).should be_true
33
37
  File.open(filename) {|f| f.read.should == "<xml></xml>"}
34
38
  end
35
- end
39
+ end
@@ -1,35 +1,148 @@
1
+ # Copyright (c) 2006-2011 Nick Sieger <nicksieger@gmail.com>
2
+ # See the file LICENSE.txt included with the distribution for
3
+ # software license details.
4
+
1
5
  require File.dirname(__FILE__) + "/../../spec_helper.rb"
2
6
  require 'stringio'
3
7
 
4
- context "The RSpec reporter" do
5
- setup do
8
+ describe "The RSpec reporter" do
9
+ before(:each) do
6
10
  @error = mock("error")
7
- @error.stub!(:exception).and_return do
8
- begin
9
- raise StandardError, "error message"
10
- rescue => e
11
- e
12
- end
13
- end
14
11
  @error.stub!(:expectation_not_met?).and_return(false)
12
+ @error.stub!(:pending_fixed?).and_return(false)
13
+ @error.stub!(:exception).and_return(StandardError.new)
15
14
  @report_mgr = mock("report manager")
16
- @fmt = CI::Reporter::RSpec.new(StringIO.new(""), false, false, @report_mgr)
15
+ @options = mock("options")
16
+ @args = [@options, StringIO.new("")]
17
+ @args.shift unless defined?(::Spec) && ::Spec::VERSION::MAJOR == 1 && ::Spec::VERSION::MINOR >= 1
18
+ @fmt = CI::Reporter::RSpec.new *@args
19
+ @fmt.report_manager = @report_mgr
20
+ @formatter = mock("formatter")
21
+ @fmt.formatter = @formatter
22
+ end
23
+
24
+ it "should use a progress bar formatter by default" do
25
+ fmt = CI::Reporter::RSpec.new *@args
26
+ fmt.formatter.should be_instance_of(CI::Reporter::RSpecFormatters::ProgressFormatter)
27
+ end
28
+
29
+ it "should use a specdoc formatter for RSpecDoc" do
30
+ fmt = CI::Reporter::RSpecDoc.new *@args
31
+ fmt.formatter.should be_instance_of(CI::Reporter::RSpecFormatters::DocFormatter)
32
+ end
33
+
34
+ it "should create a test suite with one success, one failure, and one pending" do
35
+ @report_mgr.should_receive(:write_report).and_return do |suite|
36
+ suite.testcases.length.should == 3
37
+ suite.testcases[0].should_not be_failure
38
+ suite.testcases[0].should_not be_error
39
+ suite.testcases[1].should be_error
40
+ suite.testcases[2].name.should =~ /\(PENDING\)/
41
+ end
42
+
43
+ example_group = mock "example group"
44
+ example_group.stub!(:description).and_return "A context"
45
+
46
+ @formatter.should_receive(:start).with(3)
47
+ @formatter.should_receive(:example_group_started).with(example_group)
48
+ @formatter.should_receive(:example_started).exactly(3).times
49
+ @formatter.should_receive(:example_passed).once
50
+ @formatter.should_receive(:example_failed).once
51
+ @formatter.should_receive(:example_pending).once
52
+ @formatter.should_receive(:start_dump).once
53
+ @formatter.should_receive(:dump_failure).once
54
+ @formatter.should_receive(:dump_summary).once
55
+ @formatter.should_receive(:dump_pending).once
56
+ @formatter.should_receive(:close).once
57
+
58
+ @fmt.start(3)
59
+ @fmt.example_group_started(example_group)
60
+ @fmt.example_started("should pass")
61
+ @fmt.example_passed("should pass")
62
+ @fmt.example_started("should fail")
63
+ @fmt.example_failed("should fail", 1, @error)
64
+ @fmt.example_started("should be pending")
65
+ @fmt.example_pending("A context", "should be pending", "Not Yet Implemented")
66
+ @fmt.start_dump
67
+ @fmt.dump_failure(1, mock("failure"))
68
+ @fmt.dump_summary(0.1, 3, 1, 1)
69
+ @fmt.dump_pending
70
+ @fmt.close
71
+ end
72
+
73
+ it "should support RSpec 1.0.8 #add_behavior" do
74
+ @formatter.should_receive(:start)
75
+ @formatter.should_receive(:add_behaviour).with("A context")
76
+ @formatter.should_receive(:example_started).once
77
+ @formatter.should_receive(:example_passed).once
78
+ @formatter.should_receive(:dump_summary)
79
+ @report_mgr.should_receive(:write_report)
80
+
81
+ @fmt.start(2)
82
+ @fmt.add_behaviour("A context")
83
+ @fmt.example_started("should pass")
84
+ @fmt.example_passed("should pass")
85
+ @fmt.dump_summary(0.1, 1, 0, 0)
17
86
  end
18
87
 
19
- specify "should create a test suite with one success and one failure" do
88
+ it "should use the example #description method when available" do
89
+ group = mock "example group"
90
+ group.stub!(:description).and_return "group description"
91
+ example = mock "example"
92
+ example.stub!(:description).and_return "should do something"
93
+
94
+ @formatter.should_receive(:start)
95
+ @formatter.should_receive(:example_group_started).with(group)
96
+ @formatter.should_receive(:example_started).with(example).once
97
+ @formatter.should_receive(:example_passed).once
98
+ @formatter.should_receive(:dump_summary)
20
99
  @report_mgr.should_receive(:write_report).and_return do |suite|
21
- suite.testcases.length.should == 2
22
- suite.testcases.first.should_not_be_failure
23
- suite.testcases.first.should_not_be_error
24
- suite.testcases.last.should_be_error
100
+ suite.testcases.last.name.should == "should do something"
25
101
  end
26
102
 
27
103
  @fmt.start(2)
28
- @fmt.add_context("A context", true)
29
- @fmt.spec_started("should pass")
30
- @fmt.spec_passed("should pass")
31
- @fmt.spec_started("should fail")
32
- @fmt.spec_failed("should fail", 1, @error)
33
- @fmt.dump_summary(0.1, 2, 1)
34
- end
35
- end
104
+ @fmt.example_group_started(group)
105
+ @fmt.example_started(example)
106
+ @fmt.example_passed(example)
107
+ @fmt.dump_summary(0.1, 1, 0, 0)
108
+ end
109
+
110
+ it "should create a test suite with failure in before(:all)" do
111
+ example_group = mock "example group"
112
+ example_group.stub!(:description).and_return "A context"
113
+
114
+ @formatter.should_receive(:start)
115
+ @formatter.should_receive(:example_group_started).with(example_group)
116
+ @formatter.should_receive(:example_started).once
117
+ @formatter.should_receive(:example_failed).once
118
+ @formatter.should_receive(:dump_summary)
119
+ @report_mgr.should_receive(:write_report)
120
+
121
+ @fmt.start(2)
122
+ @fmt.example_group_started(example_group)
123
+ @fmt.example_failed("should fail", 1, @error)
124
+ @fmt.dump_summary(0.1, 1, 0, 0)
125
+ end
126
+
127
+ describe 'RSpec2Failure' do
128
+ before(:each) do
129
+ @formatter = mock "formatter"
130
+ @formatter.should_receive(:format_backtrace).and_return("backtrace")
131
+ @rspec20_example = mock('RSpec2.0 Example', :execution_result => {:exception_encountered => StandardError.new('rspec2.0 ftw')})
132
+ @rspec22_example = mock('RSpec2.2 Example', :execution_result => {:exception => StandardError.new('rspec2.2 ftw')})
133
+ end
134
+
135
+ it 'should handle rspec (< 2.2) execution results' do
136
+ failure = CI::Reporter::RSpec2Failure.new(@rspec20_example, @formatter)
137
+ failure.name.should_not be_nil
138
+ failure.message.should == 'rspec2.0 ftw'
139
+ failure.location.should_not be_nil
140
+ end
141
+ it 'should handle rspec (>= 2.2) execution results' do
142
+ failure = CI::Reporter::RSpec2Failure.new(@rspec22_example, @formatter)
143
+ failure.name.should_not be_nil
144
+ failure.message.should == 'rspec2.2 ftw'
145
+ failure.location.should_not be_nil
146
+ end
147
+ end
148
+ end