Sha256: 47db7a014fd0994b5efff876ef12b528e7b80a342fe3d6dc7bcd70d534a7891c
Contents?: true
Size: 775 Bytes
Versions: 1
Compression:
Stored size: 775 Bytes
Contents
require 'minitest_helper' describe Net::SSH::Stream do let(:username) { `whoami`.strip } def exec(command, stdout: STDOUT, stderr: STDERR) exit_status = nil Net::SSH::Stream.start('localhost', username) do |stram| exit_status = stram.exec command, stdout: stdout, stderr: stderr end exit_status end it 'STDOUT' do stdout = StringIO.new exit_status = exec 'pwd', stdout: stdout stdout.rewind assert_equal 0, exit_status assert_equal "/home/#{username}", stdout.read.strip end it 'STDERR' do stderr = StringIO.new exit_status = exec 'invalid-command', stderr: stderr stderr.rewind refute_equal 0, exit_status assert_equal "bash: invalid-command: command not found", stderr.read.strip end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
net-ssh-stream-0.1.0 | spec/stream_spec.rb |