Sha256: f71fc36bd1d9d0b548054880b42a0583f829fbffb5e787ea9ed5ad70eb10d348

Contents?: true

Size: 414 Bytes

Versions: 5

Compression:

Stored size: 414 Bytes

Contents

module CommandExec
  module SpecHelper
    def capture_stderr(&block)
      previous_stderr, $stderr = $stderr, StringIO.new
      block.call
      return $stderr.string
    ensure
      $stderr = previous_stderr
    end

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

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
command_exec-0.1.3 lib/command_exec/spec_helper_module.rb
command_exec-0.1.0 lib/command_exec/spec_helper_module.rb
command_exec-0.0.3 lib/command_exec/spec_helper_module.rb
command_exec-0.0.2 lib/command_exec/spec_helper_module.rb
command_exec-0.0.1 lib/command_exec/spec_helper_module.rb