Class: Cuprum::Cli::Dependencies::SystemCommand::Mock

Inherits:
Cuprum::Cli::Dependencies::SystemCommand show all
Defined in:
lib/cuprum/cli/dependencies/system_command/mock.rb

Overview

Mock implementation of SystemCommand for testing purposes.

Defined Under Namespace

Classes: MockStatus

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Cuprum::Cli::Dependencies::SystemCommand

#capture, #spawn

Constructor Details

#initialize(captures: {}) ⇒ Mock

Returns a new instance of Mock.

Parameters:

  • captures (Hash{String => Proc, Array[String, String, Integer]}) (defaults to: {})

    the captured values to return. If the captures Hash has a key matching the command, that value will be used to generate the result.



17
18
19
20
21
22
# File 'lib/cuprum/cli/dependencies/system_command/mock.rb', line 17

def initialize(captures: {})
  super()

  @captures          = captures
  @recorded_commands = []
end

Instance Attribute Details

#recorded_commandsArray<String> (readonly)

Returns the commands recorded by the mock service.

Returns:

  • (Array<String>)

    the commands recorded by the mock service.



25
26
27
# File 'lib/cuprum/cli/dependencies/system_command/mock.rb', line 25

def recorded_commands
  @recorded_commands
end