Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

GH #3: Support for Omissions and Pending Tests from Test::Unit 2.0.x …

…(Sam Hendley)
  • Loading branch information...
commit 4ac3561cac7f3f05985f5ee8412ce1bf6c56fe00 1 parent a5d3b65
@nicksieger nicksieger authored
Showing with 16 additions and 8 deletions.
  1. +16 −8 lib/ci/reporter/test_unit.rb
View
24 lib/ci/reporter/test_unit.rb
@@ -12,15 +12,15 @@ module Reporter
# of the test.
class Failure
def self.new(fault)
- fault.kind_of?(Test::Unit::Failure) ? TestUnitFailure.new(fault) : TestUnitError.new(fault)
+ return TestUnitFailure.new(fault) if fault.kind_of?(Test::Unit::Failure)
+ return TestUnitSkipped.new(fault) if Test::Unit.constants.include?("Omission") && (fault.kind_of?(Test::Unit::Omission) || fault.kind_of?(Test::Unit::Pending))
+ TestUnitError.new(fault)
end
end
# Wrapper around a <code>Test::Unit</code> error to be used by the test suite to interpret results.
class TestUnitError
- def initialize(fault)
- @fault = fault
- end
+ def initialize(fault) @fault = fault end
def failure?() false end
def error?() true end
def name() @fault.exception.class.name end
@@ -30,9 +30,7 @@ def location() @fault.exception.backtrace.join("\n") end
# Wrapper around a <code>Test::Unit</code> failure to be used by the test suite to interpret results.
class TestUnitFailure
- def initialize(fault)
- @fault = fault
- end
+ def initialize(fault) @fault = fault end
def failure?() true end
def error?() false end
def name() Test::Unit::AssertionFailedError.name end
@@ -40,6 +38,16 @@ def message() @fault.message end
def location() @fault.location.join("\n") end
end
+ # Wrapper around a <code>Test::Unit</code> 2.0 omission.
+ class TestUnitSkipped
+ def initialize(fault) @fault = fault end
+ def failure?() false end
+ def error?() false end
+ def name() Test::Unit::Omission.name end
+ def message() @fault.message end
+ def location() @fault.location.join("\n") end
+ end
+
# Replacement Mediator that adds listeners to capture the results of the <code>Test::Unit</code> runs.
class TestUnit < Test::Unit::UI::TestRunnerMediator
def initialize(suite, report_mgr = nil)
@@ -100,7 +108,7 @@ def start_suite(suite_name)
def finish_suite
if @current_suite
- @current_suite.finish
+ @current_suite.finish
@current_suite.assertions = @suite_result.assertion_count - @last_assertion_count
@last_assertion_count = @suite_result.assertion_count
@report_manager.write_report(@current_suite)
Please sign in to comment.
Something went wrong with that request. Please try again.