Skip to content

Commit

Permalink
Fix conflict with test-unit-power_assert
Browse files Browse the repository at this point in the history
test-unit-power_assert defines Test::Unit::PowerAssert.
So when test-unit-power_assert is required before test-unit,
PowerAssert in Test::Unit::Util::BacktraceFilter refers to
Test::Unit::PowerAssert and it causes a following error.

$ ruby -rtest/unit/power_assert -rtest/unit -eexit
.../test/unit/util/backtracefilter.rb:16:in `method': undefined method `start' for class `Module' (NameError)
  • Loading branch information
k-tsj committed Mar 26, 2016
1 parent 358d23e commit 4e7b42f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/test/unit/util/backtracefilter.rb
Expand Up @@ -12,8 +12,8 @@ module BacktraceFilter
TESTUNIT_RB_FILE = /\.rb\Z/

POWERASSERT_PREFIX =
defined?(PowerAssert) ?
PowerAssert.method(:start).source_location[0].split(TESTUNIT_FILE_SEPARATORS)[0..-2] :
defined?(::PowerAssert) ?
::PowerAssert.method(:start).source_location[0].split(TESTUNIT_FILE_SEPARATORS)[0..-2] :
nil

module_function
Expand Down

0 comments on commit 4e7b42f

Please sign in to comment.