Flowdock
method

capture_io

Importance_1
v2_1_10 - Show latest stable - 0 notes - Class: 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.

Show source
Register or log in to add new notes.