method
capture_io
ruby latest stable - Class:
MiniTest::Assertions
capture_io()public
Captures $stdout and $stderr into strings:
out, err = capture_io do puts "Some info" warn "You did a bad thing" end assert_match %r%info%, out assert_match %r%bad%, err
NOTE: For efficiency, this method uses StringIO and does not capture IO for subprocesses. Use #capture_subprocess_io for that.