Module: FakePOpen

Included in:
SSH
Defined in:
lib/ssh_test.rb

Defined Under Namespace

Classes: Status

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#actionObject

Returns the value of attribute action.



24
25
26
# File 'lib/ssh_test.rb', line 24

def action
  @action
end

#commandsObject

Returns the value of attribute commands.



24
25
26
# File 'lib/ssh_test.rb', line 24

def commands
  @commands
end

#errorObject

Returns the value of attribute error.



24
25
26
# File 'lib/ssh_test.rb', line 24

def error
  @error
end

#inputObject

Returns the value of attribute input.



24
25
26
# File 'lib/ssh_test.rb', line 24

def input
  @input
end

#outputObject

Returns the value of attribute output.



24
25
26
# File 'lib/ssh_test.rb', line 24

def output
  @output
end

Instance Method Details

#popen4(*command) ⇒ Object



30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/ssh_test.rb', line 30

def popen4 *command
  @commands << command

  @input = StringIO.new
  out    = StringIO.new @output.shift.to_s
  err    = StringIO.new @error.shift.to_s

  raise if block_given?

  status = self.action ? self.action[command.join(' ')] : 0
  Process.expected Status.new(status)

  return 42, @input, out, err
end

#select(reads, writes, errs, timeout) ⇒ Object



45
46
47
# File 'lib/ssh_test.rb', line 45

def select reads, writes, errs, timeout
  [reads, writes, errs]
end