Class: Caliph::MockCommandResult

Inherits:
CommandRunResult show all
Defined in:
lib/caliph/testing/mock-command-line.rb

Instance Attribute Summary collapse

Attributes inherited from CommandRunResult

#command, #consume_timeout, #pid, #process_status

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from CommandRunResult

#consume_buffers, #format_streams, #kill, #must_succeed!, #running?, #stderr, #stdout, #succeeded?, #wait

Constructor Details

#initialize(code, streams) ⇒ MockCommandResult

Returns a new instance of MockCommandResult.



17
18
19
20
# File 'lib/caliph/testing/mock-command-line.rb', line 17

def initialize(code, streams)
  @streams = streams
  @exit_code = code
end

Instance Attribute Details

#exit_codeObject (readonly) Also known as: exit_status

Returns the value of attribute exit_code.



22
23
24
# File 'lib/caliph/testing/mock-command-line.rb', line 22

def exit_code
  @exit_code
end

#streamsObject (readonly)

Returns the value of attribute streams.



22
23
24
# File 'lib/caliph/testing/mock-command-line.rb', line 22

def streams
  @streams
end

Class Method Details

.create(*args) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
# File 'lib/caliph/testing/mock-command-line.rb', line 5

def self.create(*args)
  if args.length == 1
    args = [args[0], {1 => ""}]
  end

  if String == args[1]
    args[1] = {1 => args[1]}
  end

  return self.new(*args)
end