Class: RSpec::ShellCommand::Matchers::ExitWith
- Includes:
- Matchers::Composable
- Defined in:
- lib/rspec/shell_command/matchers/exit_with.rb
Overview
Provide implementation of exit_with matcher
Check whether given command exit with expected status
Instance Method Summary collapse
- #description ⇒ Object
- #failure_message ⇒ Object
- #failure_message_when_negated ⇒ Object
-
#initialize(status) ⇒ ExitWith
constructor
A new instance of ExitWith.
- #perform_match(actual) ⇒ Object
Methods inherited from Base
#actual_status, #actual_status_message, #make_expected_and_got_message, #matches?
Constructor Details
#initialize(status) ⇒ ExitWith
Returns a new instance of ExitWith.
13 14 15 |
# File 'lib/rspec/shell_command/matchers/exit_with.rb', line 13 def initialize(status) @status = status end |
Instance Method Details
#description ⇒ Object
36 37 38 |
# File 'lib/rspec/shell_command/matchers/exit_with.rb', line 36 def description "exit with #{description_of(@status)}" end |
#failure_message ⇒ Object
22 23 24 25 26 27 |
# File 'lib/rspec/shell_command/matchers/exit_with.rb', line 22 def ( "exited with status #{@status}", ) end |
#failure_message_when_negated ⇒ Object
29 30 31 32 33 34 |
# File 'lib/rspec/shell_command/matchers/exit_with.rb', line 29 def ( "not exited with status #{@status}", ) end |
#perform_match(actual) ⇒ Object
17 18 19 20 |
# File 'lib/rspec/shell_command/matchers/exit_with.rb', line 17 def perform_match(actual) actual_status = actual.status values_match?(@status, actual_status.exitstatus) end |