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
commit4bdfb27d9fb4958a5845e598fd7b9c7cefab94e7 (patch)
tree90fd7161b76e661e30905325486b5b8f9f48bc72 /Library/Homebrew/formula_assertions.rb
parentb61528e757feb53f5b1d4f05706a55364bd3f265 (diff)
downloadbrew-4bdfb27d9fb4958a5845e598fd7b9c7cefab94e7.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