ci_reporter 1.6.1 → 1.6.2

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.
data/History.txt CHANGED
@@ -1,3 +1,9 @@
1
+ == 1.6.2
2
+
3
+ - GH #1: Properly escape text in system-out and system-err tags (Matt Kanwisher)
4
+ - GH #2: Report rspec before(:all) failures (Edgars Beigarts)
5
+ - GH #3: Support for Omissions and Pending Tests from Test::Unit 2.0.x (Sam Hendley)
6
+
1
7
  == 1.6.1
2
8
 
3
9
  - Add 'skipped' flag for pending RSpec examples (Aaron Unger)
@@ -81,6 +81,10 @@ module CI
81
81
 
82
82
  def example_failed(name, counter, failure)
83
83
  @formatter.example_failed(name, counter, failure)
84
+ # In case we fail in before(:all)
85
+ if @suite.testcases.empty?
86
+ example_started(name)
87
+ end
84
88
  spec = @suite.testcases.last
85
89
  spec.finish
86
90
  spec.failures << RSpecFailure.new(failure)
@@ -92,10 +92,10 @@ module CI
92
92
  tc.to_xml(builder)
93
93
  end
94
94
  builder.tag! "system-out" do
95
- builder.cdata! self.stdout
95
+ builder.text! self.stdout
96
96
  end
97
97
  builder.tag! "system-err" do
98
- builder.cdata! self.stderr
98
+ builder.text! self.stderr
99
99
  end
100
100
  end
101
101
  end
@@ -12,15 +12,15 @@ module CI
12
12
  # of the test.
13
13
  class Failure
14
14
  def self.new(fault)
15
- fault.kind_of?(Test::Unit::Failure) ? TestUnitFailure.new(fault) : TestUnitError.new(fault)
15
+ return TestUnitFailure.new(fault) if fault.kind_of?(Test::Unit::Failure)
16
+ return TestUnitSkipped.new(fault) if Test::Unit.constants.include?("Omission") && (fault.kind_of?(Test::Unit::Omission) || fault.kind_of?(Test::Unit::Pending))
17
+ TestUnitError.new(fault)
16
18
  end
17
19
  end
18
20
 
19
21
  # Wrapper around a <code>Test::Unit</code> error to be used by the test suite to interpret results.
20
22
  class TestUnitError
21
- def initialize(fault)
22
- @fault = fault
23
- end
23
+ def initialize(fault) @fault = fault end
24
24
  def failure?() false end
25
25
  def error?() true end
26
26
  def name() @fault.exception.class.name end
@@ -30,9 +30,7 @@ module CI
30
30
 
31
31
  # Wrapper around a <code>Test::Unit</code> failure to be used by the test suite to interpret results.
32
32
  class TestUnitFailure
33
- def initialize(fault)
34
- @fault = fault
35
- end
33
+ def initialize(fault) @fault = fault end
36
34
  def failure?() true end
37
35
  def error?() false end
38
36
  def name() Test::Unit::AssertionFailedError.name end
@@ -40,6 +38,16 @@ module CI
40
38
  def location() @fault.location.join("\n") end
41
39
  end
42
40
 
41
+ # Wrapper around a <code>Test::Unit</code> 2.0 omission.
42
+ class TestUnitSkipped
43
+ def initialize(fault) @fault = fault end
44
+ def failure?() false end
45
+ def error?() false end
46
+ def name() Test::Unit::Omission.name end
47
+ def message() @fault.message end
48
+ def location() @fault.location.join("\n") end
49
+ end
50
+
43
51
  # Replacement Mediator that adds listeners to capture the results of the <code>Test::Unit</code> runs.
44
52
  class TestUnit < Test::Unit::UI::TestRunnerMediator
45
53
  def initialize(suite, report_mgr = nil)
@@ -100,7 +108,7 @@ module CI
100
108
 
101
109
  def finish_suite
102
110
  if @current_suite
103
- @current_suite.finish
111
+ @current_suite.finish
104
112
  @current_suite.assertions = @suite_result.assertion_count - @last_assertion_count
105
113
  @last_assertion_count = @suite_result.assertion_count
106
114
  @report_manager.write_report(@current_suite)
@@ -1,5 +1,5 @@
1
1
  module CI
2
2
  module Reporter
3
- VERSION = "1.6.1"
3
+ VERSION = "1.6.2"
4
4
  end
5
5
  end
@@ -28,8 +28,8 @@ describe "Output capture" do
28
28
  root = REXML::Document.new(@suite.to_xml).root
29
29
  root.elements.to_a('//system-out').length.should == 1
30
30
  root.elements.to_a('//system-err').length.should == 1
31
- root.elements.to_a('//system-out').first.cdatas.first.to_s.should == "Hello\n"
32
- root.elements.to_a('//system-err').first.cdatas.first.to_s.should == "Hi"
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
33
  end
34
34
 
35
35
  it "should return $stdout and $stderr to original value after finish" do
@@ -105,4 +105,21 @@ describe "The RSpec reporter" do
105
105
  @fmt.example_passed(example)
106
106
  @fmt.dump_summary(0.1, 1, 0, 0)
107
107
  end
108
+
109
+ it "should create a test suite with failure in before(:all)" do
110
+ example_group = mock "example group"
111
+ example_group.stub!(:description).and_return "A context"
112
+
113
+ @formatter.should_receive(:start)
114
+ @formatter.should_receive(:example_group_started).with(example_group)
115
+ @formatter.should_receive(:example_started).once
116
+ @formatter.should_receive(:example_failed).once
117
+ @formatter.should_receive(:dump_summary)
118
+ @report_mgr.should_receive(:write_report)
119
+
120
+ @fmt.start(2)
121
+ @fmt.example_group_started(example_group)
122
+ @fmt.example_failed("should fail", 1, @error)
123
+ @fmt.dump_summary(0.1, 1, 0, 0)
124
+ end
108
125
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 1
7
7
  - 6
8
- - 1
9
- version: 1.6.1
8
+ - 2
9
+ version: 1.6.2
10
10
  platform: ruby
11
11
  authors:
12
12
  - Nick Sieger
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-03-25 00:00:00 -05:00
17
+ date: 2010-03-26 00:00:00 -05:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency