Class: Mattock::MockCommandResult

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

Instance Attribute Summary (collapse)

Attributes inherited from CommandRunResult

#process_status

Class Method Summary (collapse)

Instance Method Summary (collapse)

Methods inherited from CommandRunResult

#must_succeed!, #stderr, #stdout, #succeeded?

Constructor Details

- (MockCommandResult) initialize(code, streams)

A new instance of MockCommandResult



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

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

Instance Attribute Details

- (Object) exit_code (readonly) Also known as: exit_status

Returns the value of attribute exit_code



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

def exit_code
  @exit_code
end

- (Object) streams (readonly)

Returns the value of attribute streams



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

def streams
  @streams
end

Class Method Details

+ (Object) create(*args)



5
6
7
8
9
10
11
12
13
14
15
# File 'lib/mattock/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