File: common.rb

package info (click to toggle)
ruby-net-ssh 1%3A6.1.0-2%2Bdeb11u1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 1,884 kB
  • sloc: ruby: 15,997; makefile: 4
file content (36 lines) | stat: -rw-r--r-- 753 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
module Authentication 
  module Methods

    module Common
      include Net::SSH::Authentication::Constants
  
      private
  
      def socket(options={})
        @socket ||= stub("socket", client_name: "me.ssh.test")
      end
  
      def transport(options={})
        @transport ||= MockTransport.new(options.merge(socket: socket))
      end
  
      def session(options={})
        @session ||= begin
          sess = stub("auth-session", logger: nil, transport: transport(options))
          def sess.next_message
            transport.next_message
          end
          sess
        end
      end
  
      def reset_session(options = {})
        @transport = nil
        @session = nil
        session(options)
      end
  
    end

  end
end