module Net::SSH::Test

def assert_scripted

the block passed to this assertion.
been built, and the SSH commands being tested are then executed within
processed. Typically, this is called immediately after a story has
and then asserts that all items described in the script have been
First asserts that a story has been described (see #story). Then yields,
def assert_scripted
  raise "there is no script to be processed" if socket.script.events.empty?
  Net::SSH::Test::Extensions::IO.with_test_extension { yield }
  assert socket.script.events.empty?, "there should not be any remaining scripted events, but there are still" \
                                      "#{socket.script.events.length} pending"
end

def connection(options = {})

a mock socket (#socket).
in these tests. It is a fully functional SSH session, operating over
Returns the connection session (Net::SSH::Connection::Session) for use
def connection(options = {})
  @connection ||= Net::SSH::Connection::Session.new(transport(options), options)
end

def socket(options = {})

Net::SSH::Test::Socket).
Returns the test socket instance to use for these tests (see
def socket(options = {})
  @socket ||= Net::SSH::Test::Socket.new
end

def story

Otherwise, simply returns the socket's script. See Net::SSH::Test::Script.
If a block is given, yields the script for the test socket (#socket).
def story
  Net::SSH::Test::Extensions::IO.with_test_extension { yield socket.script if block_given? }
  return socket.script
end

def transport(options = {})

over a mock socket (#socket).
in these tests. It is a fully functional SSH transport session, operating
Returns the transport session (Net::SSH::Transport::Session) for use
def transport(options = {})
  @transport ||= Net::SSH::Transport::Session.new(
    options[:host] || "localhost",
    options.merge(kex: "test", host_key: "ssh-rsa", append_all_supported_algorithms: true, verify_host_key: :never, proxy: socket(options))
  )
end