[rubygems/rubygems] Extract assert_output to assert_empty and assert_equal with capture_output

https://github.com/rubygems/rubygems/commit/f6759440a4
This commit is contained in:
Hiroshi SHIBATA 2020-03-18 17:56:41 +09:00
Родитель 183174475c
Коммит 81d793a921
4 изменённых файлов: 14 добавлений и 5 удалений

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

@ -1966,9 +1966,11 @@ You may need to `gem install -g` to install missing gems
EXPECTED
Gem::Deprecate.skip_during do
assert_output nil, expected do
actual_stdout, actual_stderr = capture_output do
Gem.use_gemdeps
end
assert_empty actual_stdout
assert_equal(expected, actual_stderr)
end
ensure
ENV['RUBYGEMS_GEMDEPS'] = rubygems_gemdeps

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

@ -87,9 +87,10 @@ Gems to install:
a-2
EXPECTED
assert_output expected do
actual, _= capture_output do
rs.install_from_gemdeps :gemdeps => io.path, :explain => true
end
assert_equal(expected, actual)
end
end

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

@ -3021,9 +3021,11 @@ WARN: Clearing out unresolved specs. Try 'gem cleanup <gem>'
Please report a bug if this causes problems.
EXPECTED
assert_output nil, expected do
actual_stdout, actual_stderr = capture_output do
specification.reset
end
assert_empty actual_stdout
assert_equal(expected, actual_stderr)
end
def test_unresolved_specs_with_versions
@ -3052,9 +3054,11 @@ WARN: Clearing out unresolved specs. Try 'gem cleanup <gem>'
Please report a bug if this causes problems.
EXPECTED
assert_output nil, expected do
actual_stdout, actual_stderr = capture_output do
specification.reset
end
assert_empty actual_stdout
assert_equal(expected, actual_stderr)
end
def test_duplicate_runtime_dependency

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

@ -47,9 +47,11 @@ class TestGemVersion < Gem::TestCase
assert_equal false, Gem::Version.correct?("an incorrect version")
expected = "nil versions are discouraged and will be deprecated in Rubygems 4\n"
assert_output nil, expected do
actual_stdout, actual_stderr = capture_output do
Gem::Version.correct?(nil)
end
assert_empty actual_stdout
assert_equal(expected, actual_stderr)
end
def test_class_new_subclass