1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Migrate {assert,refute}_patch_exits for compatibility with Minitest5

This commit is contained in:
Hiroshi SHIBATA 2020-03-30 21:32:26 +09:00
parent 7a2177ea50
commit e5db3da9d3
No known key found for this signature in database
GPG key ID: F9CF13417264FAC2
2 changed files with 10 additions and 12 deletions

View file

@ -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

View file

@ -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:
#