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

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

f6759440a4
This commit is contained in:
Hiroshi SHIBATA 2020-03-18 17:56:41 +09:00
parent 183174475c
commit 81d793a921
Notes: git 2021-05-12 17:25:22 +09:00
4 changed files with 14 additions and 5 deletions

View file

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

View file

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

View file

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

View file

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