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:



94
95
96
97
# File 'lib/net/ssh/test/extensions.rb', line 94

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.



103
104
105
106
# File 'lib/net/ssh/test/extensions.rb', line 103

def send_data_for_test(data)
  send_data_for_real(data)
  enqueue_pending_output
end