capture_io (MiniTest::Assertions)

    # File lib/minitest/unit.rb, line 190
        def capture_io
          require 'stringio'

          orig_stdout, orig_stderr         = $stdout, $stderr
          captured_stdout, captured_stderr = StringIO.new, StringIO.new
          $stdout, $stderr                 = captured_stdout, captured_stderr

          yield

          return captured_stdout.string, captured_stderr.string
        ensure
          $stdout = orig_stdout
          $stderr = orig_stderr
        end