formula_assertions: use minitest
We are migrating away from using system gems, and we already have minitest in our dependency tree, so we might as well use it.
This commit is contained in:
parent
68ae267fba
commit
bb4e74042a
@ -6,6 +6,7 @@ source "https://rubygems.org"
|
|||||||
gem "bootsnap", require: false
|
gem "bootsnap", require: false
|
||||||
gem "byebug", require: false
|
gem "byebug", require: false
|
||||||
gem "codecov", require: false
|
gem "codecov", require: false
|
||||||
|
gem "minitest", require: false
|
||||||
gem "nokogiri", require: false
|
gem "nokogiri", require: false
|
||||||
gem "parallel_tests", require: false
|
gem "parallel_tests", require: false
|
||||||
gem "ronn", require: false
|
gem "ronn", require: false
|
||||||
|
|||||||
@ -179,6 +179,7 @@ DEPENDENCIES
|
|||||||
codecov
|
codecov
|
||||||
concurrent-ruby
|
concurrent-ruby
|
||||||
mechanize
|
mechanize
|
||||||
|
minitest
|
||||||
nokogiri
|
nokogiri
|
||||||
parallel_tests
|
parallel_tests
|
||||||
patchelf
|
patchelf
|
||||||
|
|||||||
@ -35,6 +35,8 @@ module Homebrew
|
|||||||
def test
|
def test
|
||||||
args = test_args.parse
|
args = test_args.parse
|
||||||
|
|
||||||
|
Homebrew.install_bundler_gems!
|
||||||
|
|
||||||
require "formula_assertions"
|
require "formula_assertions"
|
||||||
require "formula_free_port"
|
require "formula_free_port"
|
||||||
|
|
||||||
|
|||||||
@ -8,8 +8,38 @@ module Homebrew
|
|||||||
module Assertions
|
module Assertions
|
||||||
include Context
|
include Context
|
||||||
|
|
||||||
require "test/unit/assertions"
|
require "minitest"
|
||||||
include ::Test::Unit::Assertions
|
require "minitest/assertions"
|
||||||
|
include ::Minitest::Assertions
|
||||||
|
|
||||||
|
attr_writer :assertions
|
||||||
|
|
||||||
|
def assertions
|
||||||
|
@assertions ||= 0
|
||||||
|
end
|
||||||
|
|
||||||
|
# Test::Unit backwards compatibility methods
|
||||||
|
{
|
||||||
|
assert_raise: :assert_raises,
|
||||||
|
assert_not_empty: :refute_empty,
|
||||||
|
assert_not_equal: :refute_equal,
|
||||||
|
assert_not_in_delta: :refute_in_delta,
|
||||||
|
assert_not_in_epsilon: :refute_in_epsilon,
|
||||||
|
assert_not_includes: :refute_includes,
|
||||||
|
assert_not_instance_of: :refute_instance_of,
|
||||||
|
assert_not_kind_of: :refute_kind_of,
|
||||||
|
assert_no_match: :refute_match,
|
||||||
|
assert_not_nil: :refute_nil,
|
||||||
|
assert_not_operator: :refute_operator,
|
||||||
|
assert_not_predicate: :refute_predicate,
|
||||||
|
assert_not_respond_to: :refute_respond_to,
|
||||||
|
assert_not_same: :refute_same,
|
||||||
|
}.each do |old_method, new_method|
|
||||||
|
define_method(old_method) do |*args|
|
||||||
|
# odeprecated old_method, new_method
|
||||||
|
send(new_method, *args)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
# Returns the output of running cmd, and asserts the exit status.
|
# Returns the output of running cmd, and asserts the exit status.
|
||||||
# @api public
|
# @api public
|
||||||
@ -18,7 +48,7 @@ module Homebrew
|
|||||||
output = `#{cmd}`
|
output = `#{cmd}`
|
||||||
assert_equal result, $CHILD_STATUS.exitstatus
|
assert_equal result, $CHILD_STATUS.exitstatus
|
||||||
output
|
output
|
||||||
rescue Test::Unit::AssertionFailedError
|
rescue Minitest::Assertion
|
||||||
puts output if verbose?
|
puts output if verbose?
|
||||||
raise
|
raise
|
||||||
end
|
end
|
||||||
@ -35,7 +65,7 @@ module Homebrew
|
|||||||
end
|
end
|
||||||
assert_equal result, $CHILD_STATUS.exitstatus unless result.nil?
|
assert_equal result, $CHILD_STATUS.exitstatus unless result.nil?
|
||||||
output
|
output
|
||||||
rescue Test::Unit::AssertionFailedError
|
rescue Minitest::Assertion
|
||||||
puts output if verbose?
|
puts output if verbose?
|
||||||
raise
|
raise
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user