diff --git a/spec/support/net_ssh_story_helpers.rb b/spec/support/net_ssh_story_helpers.rb index ee9f26a..949b408 100644 --- a/spec/support/net_ssh_story_helpers.rb +++ b/spec/support/net_ssh_story_helpers.rb @@ -2,6 +2,24 @@ module NetSSHStoryHelpers require 'net/ssh/test' include Net::SSH::Test + # FIXME: must be moved elsewhere or implemented another way/form. + class ::Net::SSH::Test::Channel + def gets_packet(type, *args) + gets_data(sftp_packet(type, *args)) + end + + def sends_packet(type, *args) + sends_data(sftp_packet(type, *args)) + end + + private + + def sftp_packet(type, *args) + data = Net::SSH::Buffer.from(*args) + Net::SSH::Buffer.from(:long, data.length + 1, :byte, type, :raw, data).to_s + end + end + def story_with_new_channel story do |session| ch = session.opens_channel