Module: Net::SSH::Test::Extensions::Channel

Defined in:
lib/net/ssh/test/extensions.rb

Overview

An extension to Net::SSH::Connection::Channel. Facilitates unit testing.

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object

:nodoc:


96
97
98
99
# File 'lib/net/ssh/test/extensions.rb', line 96

def self.included(base) #:nodoc:
  base.send :alias_method, :send_data_for_real, :send_data
  base.send :alias_method, :send_data, :send_data_for_test
end

Instance Method Details

#send_data_for_test(data) ⇒ Object

The testing version of Net::SSH::Connection::Channel#send_data. Calls the original implementation, and then immediately enqueues the data for output so that scripted sends are properly interpreted as discrete (rather than concatenated) data packets.


105
106
107
108
# File 'lib/net/ssh/test/extensions.rb', line 105

def send_data_for_test(data)
  send_data_for_real(data)
  enqueue_pending_output
end