Method: CommandExec::SpecHelper#capture_stdout

Defined in:
lib/command_exec/spec_helper_module.rb

#capture_stdout(&block) ⇒ Object



11
12
13
14
15
16
17
# File 'lib/command_exec/spec_helper_module.rb', line 11

def capture_stdout(&block)
  previous_stdout, $stdout = $stdout, StringIO.new
  block.call
  return $stdout.string
ensure
  $stdout = previous_stdout
end