Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

do not search ancestors when checking Test::Unit.const_defined? #73

Merged
merged 1 commit into from

2 participants

@seanwalbran

Fix a false-positive detection of Test::Unit::Notification being defined due to const_defined? searching up the object heirarchy by default, which results in an uninitialized-constant-name-error at runtime if e.g. :Notification is defined elsewhere.

[1] pry(main)> Test::Unit.const_defined?(:Notification)
=> true
[2] pry(main)> Test::Unit.const_defined?(:Notification, false)
=> false
[5] pry(main)> Object.const_defined?(:Notification, false)
=> true

(Introduced in this commit: e7a0ff8
)

@nicksieger nicksieger merged commit d20a340 into ci-reporter:master
@nicksieger
Owner

Thanks Sean! (sigh on the const_defined? collision).

@seanwalbran

Thanks for the quick merge, much appreciated!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 2 additions and 2 deletions.
  1. +2 −2 lib/ci/reporter/test_unit.rb
View
4 lib/ci/reporter/test_unit.rb
@@ -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.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)
+ return TestUnitSkipped.new(fault) if Test::Unit.const_defined?(:Omission, false) && (fault.kind_of?(Test::Unit::Omission) || fault.kind_of?(Test::Unit::Pending))
+ return TestUnitNotification.new(fault) if Test::Unit.const_defined?(:Notification, false) && fault.kind_of?(Test::Unit::Notification)
TestUnitError.new(fault)
end
end
Something went wrong with that request. Please try again.