Class: CliTest::Execution
- Inherits:
-
Object
- Object
- CliTest::Execution
- Extended by:
- Forwardable
- Defined in:
- lib/cli-test/execution.rb
Overview
Encapsulates the execution results from the command
Instance Attribute Summary collapse
-
#status ⇒ Object
readonly
Returns the value of attribute status.
-
#stderr ⇒ String
readonly
The stderr from the execution.
-
#stdout ⇒ String
readonly
The stdout from the execution.
Instance Method Summary collapse
-
#initialize(stdout, stderr, status) ⇒ CliTest::Execution
constructor
creates an object of type CliTest::Execution.
-
#output ⇒ String
returns the stdout and stderr combined with a newline (
\n
) separator. -
#successful? ⇒ Boolean
returns true if the status code for the execution is is zero.
Constructor Details
#initialize(stdout, stderr, status) ⇒ CliTest::Execution
creates an object of type CliTest::Execution
23 24 25 26 27 |
# File 'lib/cli-test/execution.rb', line 23 def initialize(stdout, stderr, status) @stdout = stdout @stderr = stderr @status = status end |
Instance Attribute Details
#status ⇒ Object (readonly)
Returns the value of attribute status.
15 |
# File 'lib/cli-test/execution.rb', line 15 attr_reader :stdout, :stderr, :status |
#stderr ⇒ String (readonly)
Returns the stderr from the execution.
15 |
# File 'lib/cli-test/execution.rb', line 15 attr_reader :stdout, :stderr, :status |
#stdout ⇒ String (readonly)
Returns the stdout from the execution.
15 16 17 |
# File 'lib/cli-test/execution.rb', line 15 def stdout @stdout end |
Instance Method Details
#output ⇒ String
returns the stdout and stderr combined with a newline (\n
) separator.
41 42 43 |
# File 'lib/cli-test/execution.rb', line 41 def output @stdout + "\n" + @stderr end |
#successful? ⇒ Boolean
returns true if the status code for the execution is is zero
33 34 35 |
# File 'lib/cli-test/execution.rb', line 33 def successful? @status.success? end |