Migrate {assert,refute}_patch_exits for compatibility with Minitest5

This commit is contained in:
Hiroshi SHIBATA 2020-03-30 21:32:26 +09:00
Родитель 7a2177ea50
Коммит e5db3da9d3
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: F9CF13417264FAC2
2 изменённых файлов: 10 добавлений и 12 удалений

Просмотреть файл

@ -127,12 +127,6 @@ class Gem::TestCase < (defined?(Minitest::Test) ? Minitest::Test : MiniTest::Uni
assert_equal expected.sort, loaded.sort if expected
end
# TODO: move to minitest
def assert_path_exists(path, msg = nil)
msg = message(msg) { "Expected path '#{path}' to exist" }
assert File.exist?(path), msg
end
def assert_directory_exists(path, msg = nil)
msg = message(msg) { "Expected path '#{path}' to be a directory" }
assert_path_exists path
@ -226,12 +220,6 @@ class Gem::TestCase < (defined?(Minitest::Test) ? Minitest::Test : MiniTest::Uni
end
end
# TODO: move to minitest
def refute_path_exists(path, msg = nil)
msg = message(msg) { "Expected path '#{path}' to not exist" }
refute File.exist?(path), msg
end
def scan_make_command_lines(output)
output.scan(/^#{Regexp.escape make_command}(?:[[:blank:]].*)?$/)
end

Просмотреть файл

@ -446,6 +446,16 @@ module MiniTest
assert caught, message(msg) { default }
end
def assert_path_exists(path, msg = nil)
msg = message(msg) { "Expected path '#{path}' to exist" }
assert File.exist?(path), msg
end
def refute_path_exists(path, msg = nil)
msg = message(msg) { "Expected path '#{path}' to not exist" }
refute File.exist?(path), msg
end
##
# Captures $stdout and $stderr into strings:
#