Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Use const_defined? for checking a constant is defined #58

Merged
merged 1 commit into from May 11, 2012
Jump to file or symbol
Failed to load files and symbols.
+2 −2
Split
@@ -13,8 +13,8 @@ module Reporter
class Failure
def self.new(fault)
return TestUnitFailure.new(fault) if fault.kind_of?(Test::Unit::Failure)
- return TestUnitSkipped.new(fault) if !(Test::Unit.constants & [:Omission, "Omission"]).empty? && (fault.kind_of?(Test::Unit::Omission) || fault.kind_of?(Test::Unit::Pending))
- return TestUnitNotification.new(fault) if !(Test::Unit.constants & [:Notification, "Notification"]).empty? && fault.kind_of?(Test::Unit::Notification)
+ return TestUnitSkipped.new(fault) if Test::Unit.const_defined?(:Omission) && (fault.kind_of?(Test::Unit::Omission) || fault.kind_of?(Test::Unit::Pending))
+ return TestUnitNotification.new(fault) if Test::Unit.const_defined?(:Notification) && fault.kind_of?(Test::Unit::Notification)
TestUnitError.new(fault)
end
end