aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/formula_assertions.rb
diff options
context:
space:
mode:
authorJack Nagel2015-01-13 12:33:50 -0500
committerJack Nagel2015-01-13 12:33:50 -0500
commitea5adc7c3ba2f141ef39b6f45a8db1230828cd52 (patch)
treedc8cee704b0177a14eee8fb082f21dcc2938a1a1 /Library/Homebrew/formula_assertions.rb
parente3326f64560136abe6260b2ee0cfb3aad6c72d69 (diff)
downloadhomebrew-ea5adc7c3ba2f141ef39b6f45a8db1230828cd52.tar.bz2
Move assertion setup into formula_assertions.rb
Diffstat (limited to 'Library/Homebrew/formula_assertions.rb')
-rw-r--r--Library/Homebrew/formula_assertions.rb23
1 files changed, 21 insertions, 2 deletions
diff --git a/Library/Homebrew/formula_assertions.rb b/Library/Homebrew/formula_assertions.rb
index a82b06f81..ea12ce001 100644
--- a/Library/Homebrew/formula_assertions.rb
+++ b/Library/Homebrew/formula_assertions.rb
@@ -1,7 +1,26 @@
-require 'test/unit/assertions'
-
module Homebrew
module Assertions
+ if defined?(Gem)
+ begin
+ gem "minitest", "< 5.0.0"
+ rescue Gem::LoadError
+ require "test/unit/assertions"
+ else
+ require "minitest/unit"
+ require "test/unit/assertions"
+ end
+ else
+ require "test/unit/assertions"
+ end
+
+ if defined?(MiniTest::Assertion)
+ FailedAssertion = MiniTest::Assertion
+ elsif defined?(Minitest::Assertion)
+ FailedAssertion = Minitest::Assertion
+ else
+ FailedAssertion = Test::Unit::AssertionFailedError
+ end
+
include Test::Unit::Assertions
# Returns the output of running cmd, and asserts the exit status