Sha256: 4d4b7660d22b86e535ec01a9e66575712a65b1d1c1fdb71de88e2a0eb7935182

Contents?: true

Size: 329 Bytes

Versions: 4

Compression:

Stored size: 329 Bytes

Contents

# Return string containing the STDIN and STDOUT output emitted within
# the +block+.
def output_for(&block)
  output = StringIO.new

  stdout_old = $stdout
  stderr_old = $stderr

  $stdout = output
  $stderr = output

  block.call
  
  output.rewind
  return output.read
ensure
  $stdout = stdout_old
  $stderr = stderr_old
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
puppet-module-0.3.4 spec/support/output_support.rb
puppet-module-0.3.3 spec/support/output_support.rb
puppet-module-0.3.2 spec/support/output_support.rb
puppet-module-0.3.0 spec/support/output_support.rb