diff options
author | Hiroshi SHIBATA <hsbt@ruby-lang.org> | 2020-03-30 21:32:26 +0900 |
---|---|---|
committer | Hiroshi SHIBATA <hsbt@ruby-lang.org> | 2020-03-30 21:32:26 +0900 |
commit | e5db3da9d34f0a7595208863301c044b612adbed (patch) | |
tree | 8a6a642cda3214ce437e38579070ef01946a91ec | |
parent | 7a2177ea507c3137acb961cbc6fb976999b7af67 (diff) | |
download | ruby-e5db3da9d34f0a7595208863301c044b612adbed.tar.gz |
Migrate {assert,refute}_patch_exits for compatibility with Minitest5
-rw-r--r-- | lib/rubygems/test_case.rb | 12 | ||||
-rw-r--r-- | tool/lib/minitest/unit.rb | 10 |
2 files changed, 10 insertions, 12 deletions
diff --git a/lib/rubygems/test_case.rb b/lib/rubygems/test_case.rb index 3c00a491c1..e56150caf9 100644 --- a/lib/rubygems/test_case.rb +++ b/lib/rubygems/test_case.rb @@ -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 diff --git a/tool/lib/minitest/unit.rb b/tool/lib/minitest/unit.rb index 3d1b796fdf..c85b41e5fc 100644 --- a/tool/lib/minitest/unit.rb +++ b/tool/lib/minitest/unit.rb @@ -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: # |