Skip to content

Instantly share code, notes, and snippets.

@samhendley
Created March 23, 2010 13:24
Show Gist options
  • Save samhendley/341156 to your computer and use it in GitHub Desktop.
Save samhendley/341156 to your computer and use it in GitHub Desktop.
module CI
module Reporter
# monkey patch that stops it from exploding when used with the new features in
# test/unit 2.0.x.
class Failure
def self.new(fault)
return TestUnitFailure.new(fault) if fault.kind_of?(Test::Unit::Failure)
if Test::Unit.constants.include? "Omission"
return TestUnitSkipped.new(fault) if fault.kind_of?(Test::Unit::Omission)
return TestUnitSkipped.new(fault) if fault.kind_of?(Test::Unit::Pending)
end
TestUnitError.new(fault)
end
end
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
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment