Skip to content

Commit f675944

Browse files
committed
Extract assert_output to assert_empty and assert_equal with capture_output
1 parent 51fdbe5 commit f675944

File tree

4 files changed

+14
-5
lines changed

4 files changed

+14
-5
lines changed

test/rubygems/test_gem.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1966,9 +1966,11 @@ def test_use_gemdeps_missing_gem
19661966
EXPECTED
19671967

19681968
Gem::Deprecate.skip_during do
1969-
assert_output nil, expected do
1969+
actual_stdout, actual_stderr = capture_output do
19701970
Gem.use_gemdeps
19711971
end
1972+
assert_empty actual_stdout
1973+
assert_equal(expected, actual_stderr)
19721974
end
19731975
ensure
19741976
ENV['RUBYGEMS_GEMDEPS'] = rubygems_gemdeps

test/rubygems/test_gem_request_set.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,9 +87,10 @@ def test_install_from_gemdeps_explain
8787
a-2
8888
EXPECTED
8989

90-
assert_output expected do
90+
actual, _= capture_output do
9191
rs.install_from_gemdeps :gemdeps => io.path, :explain => true
9292
end
93+
assert_equal(expected, actual)
9394
end
9495
end
9596

test/rubygems/test_gem_specification.rb

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3021,9 +3021,11 @@ def test_unresolved_specs
30213021
Please report a bug if this causes problems.
30223022
EXPECTED
30233023

3024-
assert_output nil, expected do
3024+
actual_stdout, actual_stderr = capture_output do
30253025
specification.reset
30263026
end
3027+
assert_empty actual_stdout
3028+
assert_equal(expected, actual_stderr)
30273029
end
30283030

30293031
def test_unresolved_specs_with_versions
@@ -3052,9 +3054,11 @@ def test_unresolved_specs_with_versions
30523054
Please report a bug if this causes problems.
30533055
EXPECTED
30543056

3055-
assert_output nil, expected do
3057+
actual_stdout, actual_stderr = capture_output do
30563058
specification.reset
30573059
end
3060+
assert_empty actual_stdout
3061+
assert_equal(expected, actual_stderr)
30583062
end
30593063

30603064
def test_duplicate_runtime_dependency

test/rubygems/test_gem_version.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,11 @@ def test_class_correct
4747
assert_equal false, Gem::Version.correct?("an incorrect version")
4848

4949
expected = "nil versions are discouraged and will be deprecated in Rubygems 4\n"
50-
assert_output nil, expected do
50+
actual_stdout, actual_stderr = capture_output do
5151
Gem::Version.correct?(nil)
5252
end
53+
assert_empty actual_stdout
54+
assert_equal(expected, actual_stderr)
5355
end
5456

5557
def test_class_new_subclass

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy