Class: CI::Reporter::Failure

Inherits:
Object
  • Object
show all
Defined in:
lib/ci/reporter/test_unit.rb

Overview

Factory for constructing either a CI::Reporter::TestUnitFailure or CI::Reporter::TestUnitError depending on the result of the test.

Class Method Summary collapse

Class Method Details

.new(fault) ⇒ Object



19
20
21
22
23
24
25
26
# File 'lib/ci/reporter/test_unit.rb', line 19

def self.new(fault)
  return TestUnitFailure.new(fault) if fault.kind_of?(Test::Unit::Failure)
  return TestUnitSkipped.new(fault) if omission_constant? &&
    (fault.kind_of?(Test::Unit::Omission) || fault.kind_of?(Test::Unit::Pending))
  return TestUnitNotification.new(fault) if notification_constant? &&
    fault.kind_of?(Test::Unit::Notification)
  TestUnitError.new(fault)
end

.notification_constant?Boolean

Returns:

  • (Boolean)


15
16
17
# File 'lib/ci/reporter/test_unit.rb', line 15

def self.notification_constant?
  Test::Unit.const_defined?(:Notification, false)
end

.omission_constant?Boolean

Returns:

  • (Boolean)


11
12
13
# File 'lib/ci/reporter/test_unit.rb', line 11

def self.omission_constant?
  Test::Unit.const_defined?(:Omission, false)
end