Sha256: 427dfbfb620daea39ed4a9e63df9d2055fd39d03217413d1f076794826568151

Contents?: true

Size: 375 Bytes

Versions: 2

Compression:

Stored size: 375 Bytes

Contents

require 'rspec'
require 'rbsh'
require 'rbsh/cli'
require 'tapp'

def capture_stdout
  old_stdout = $stdout.dup
  rd, wr = IO.method(:pipe).arity.zero? ? IO.pipe : IO.pipe("BINARY")
  $stdout = wr
  yield
  wr.close
  rd.read
ensure
  $stdout = old_stdout
end

def rbsh(*args)
  capture_stdout do
    begin
      Rbsh::CLI.start(args)
    rescue SystemExit
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rbsh-0.0.2 spec/spec_helper.rb
rbsh-0.0.1 spec/spec_helper.rb