Sha256: 3621428c56e6003ebd2503879ddc7cdcdf14631e114e8a34c9c8b8704036822c

Contents?: true

Size: 370 Bytes

Versions: 2

Compression:

Stored size: 370 Bytes

Contents

module ProcessHelper
  def run(args, stdin=nil)
    if args.kind_of?(String)
      args = [args]
    end
    stub_const('ARGV', args)

    if stdin.kind_of?(Array)
      stdin = stdin.join("\n")
    end
    stdin_double = double
    stdin_double.stub(:read).and_return(stdin)
    stub_const('STDIN', stdin_double)

    process = Ru::Process.new
    process.run
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ru-0.1.1 spec/support/process_helper.rb
ru-0.1.0 spec/support/process_helper.rb