aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHiroshi SHIBATA <hsbt@ruby-lang.org>2020-03-30 21:32:26 +0900
committerHiroshi SHIBATA <hsbt@ruby-lang.org>2020-03-30 21:32:26 +0900
commite5db3da9d34f0a7595208863301c044b612adbed (patch)
tree8a6a642cda3214ce437e38579070ef01946a91ec
parent7a2177ea507c3137acb961cbc6fb976999b7af67 (diff)
downloadruby-e5db3da9d34f0a7595208863301c044b612adbed.tar.gz
Migrate {assert,refute}_patch_exits for compatibility with Minitest5
-rw-r--r--lib/rubygems/test_case.rb12
-rw-r--r--tool/lib/minitest/unit.rb10
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:
#