Class: RSpec::ShellCommand::Matchers::Base
- Inherits:
-
Object
- Object
- RSpec::ShellCommand::Matchers::Base
show all
- Defined in:
- lib/rspec/shell_command/matchers/base.rb
Overview
Base class for a matcher class
NOTE: This is a internal class
Instance Method Summary
collapse
Instance Method Details
#actual_status ⇒ Object
20
21
22
|
# File 'lib/rspec/shell_command/matchers/base.rb', line 20
def actual_status
@actual.status
end
|
#actual_status_message ⇒ Object
24
25
26
27
28
29
30
31
32
|
# File 'lib/rspec/shell_command/matchers/base.rb', line 24
def actual_status_message
if actual_status.exited?
"exited with status #{actual_status.exitstatus}"
elsif actual_status.signaled?
"terminated by signal #{actual_status.termsig}"
else
"been unknown status: #{@actual.inspect}"
end
end
|
#make_expected_and_got_message(expected, got) ⇒ Object
34
35
36
37
38
|
# File 'lib/rspec/shell_command/matchers/base.rb', line 34
def make_expected_and_got_message(expected, got)
"\n"\
"expected: #{expected}\n"\
" got: #{got}"
end
|
#matches?(actual) ⇒ Boolean
11
12
13
14
15
16
17
18
|
# File 'lib/rspec/shell_command/matchers/base.rb', line 11
def matches?(actual)
unless actual.is_a?(RSpec::ShellCommand)
raise TypeError,
"expected RSpec::ShellCommand, but got #{actual.inspect}"
end
@actual = actual
perform_match(actual.execute)
end
|