aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorMike McQuaid2017-07-07 10:14:21 +0100
committerGitHub2017-07-07 10:14:21 +0100
commitddb1fd79814084a76413010cd3005f0cd14a31e5 (patch)
treef643adec6e580312c2028d22c6916a9175b1d340 /Library
parente8c38a0165b3fccae4958cbdd8beadbfe13d15c2 (diff)
parent5c2fa1fc1f5169ec1921a9605622569ab5f728e2 (diff)
downloadbrew-ddb1fd79814084a76413010cd3005f0cd14a31e5.tar.bz2
Merge pull request #2841 from mistydemeo/formula_assertions_constant
Define a custom assertion failure error for cross-version compat
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/dev-cmd/test.rb2
-rw-r--r--Library/Homebrew/formula_assertions.rb5
2 files changed, 6 insertions, 1 deletions
diff --git a/Library/Homebrew/dev-cmd/test.rb b/Library/Homebrew/dev-cmd/test.rb
index a8661179f..c678171ac 100644
--- a/Library/Homebrew/dev-cmd/test.rb
+++ b/Library/Homebrew/dev-cmd/test.rb
@@ -83,7 +83,7 @@ module Homebrew
exec(*args)
end
end
- rescue MiniTest::Assertion => e
+ rescue ::Test::Unit::AssertionFailedError => e
ofail "#{f.full_name}: failed"
puts e.message
rescue Exception => e
diff --git a/Library/Homebrew/formula_assertions.rb b/Library/Homebrew/formula_assertions.rb
index f81087a3d..2ba5767a7 100644
--- a/Library/Homebrew/formula_assertions.rb
+++ b/Library/Homebrew/formula_assertions.rb
@@ -3,6 +3,11 @@ module Homebrew
require "test/unit/assertions"
include ::Test::Unit::Assertions
+ # TODO: remove this when we no longer support Ruby 2.0.
+ unless defined?(Test::Unit::AssertionFailedError)
+ Test::Unit::AssertionFailedError = MiniTest::Assertion
+ end
+
# Returns the output of running cmd, and asserts the exit status
def shell_output(cmd, result = 0)
ohai cmd