Skip to content

Commit 2b565d9

Browse files
committed
Use capture_output instead of capture_io for test-unit.
1 parent d1c28b9 commit 2b565d9

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

test/benchmark/test_benchmark.rb

+2-6
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,8 @@ def bench(type = :bm, *args, &block)
3434
end
3535
end
3636

37-
def capture_output
38-
capture_io { yield }.first.gsub(/[ \-]\d\.\d{6}/, ' --time--')
39-
end
40-
4137
def capture_bench_output(type, *args, &block)
42-
capture_output { bench(type, *args, &block) }
38+
capture_output { bench(type, *args, &block) }.first.gsub(/[ \-]\d\.\d{6}/, ' --time--')
4339
end
4440

4541
def test_tms_outputs_nicely
@@ -85,7 +81,7 @@ def test_benchmark_makes_extra_calcultations_with_an_Array_at_the_end_of_the_ben
8581

8682
def test_bm_returns_an_Array_of_the_times_with_the_labels
8783
[:bm, :bmbm].each do |meth|
88-
capture_io do
84+
capture_output do
8985
results = bench(meth)
9086
assert_instance_of(Array, results)
9187
assert_equal(labels.size, results.size)

0 commit comments

Comments
 (0)