Class: Cuprum::Cli::Dependencies::SystemCommand::Mock
- Parent Namespace
- Cuprum::Cli::Dependencies::SystemCommand
- Inherited Classes
- Cuprum::Cli::Dependencies::SystemCommand
>
Object
- Defined In
- lib/cuprum/cli/dependencies/system_command/mock.rb
Table Of Contents
Overview
Mock implementation of SystemCommand for testing purposes.
Back To Top
Defined Under Namespace
- Classes
- MockStatus
Back To Top
Constructor
#initialize(captures: {}) => Mock
Parameters
- captures (Hash{String => Proc, Array[String, String, Integer]}) — the captured values to return. If the captures Hash has a key matching
the command, that value will be used to generate the result.
Returns
- (Mock) — a new instance of Mock
Back To Top
Instance Attributes
#recorded_commands => Array<String> (readonly)
Returns
- (Array<String>) — the commands recorded by the mock service.
Back To Top
Instance Methods
- Inherited From
- Cuprum::Cli::Dependencies::SystemCommand
Executes the system command and returns the captured output.
Parameters
- command (String) — the command to run.
- arguments (Array<String>) — command-line flags or arguments to pass
to the command.
- enviroment (Hash<String, Object>) — environment variables to set
for the command.
- options (Hash<String, Object>) — command line options and values to
pass to the command.
Returns
#spawn(command, arguments: [], enviroment:, options: {}) => Cuprum::Result<nil>
- Inherited From
- Cuprum::Cli::Dependencies::SystemCommand
Spawns a process to run the system command.
Parameters
- command (String) — the command to run.
- arguments (Array<String>) — command-line flags or arguments to pass
to the command.
- enviroment (Hash<String, Object>) — environment variables to set
for the command.
- options (Hash<String, Object>) — command line options and values to
pass to the command.
Returns
- (Cuprum::Result<nil>) — a result with status :success if the
process ran successfully; otherwise, a result with status :failure and
an Error.
Back To Top
Back to
Documentation |
Reference
|
Cuprum
|
Cuprum::Cli
|
Cuprum::Cli::Dependencies
|
Cuprum::Cli::Dependencies::SystemCommand