Class: ShellMock::CallVerifier
- Inherits:
-
Object
- Object
- ShellMock::CallVerifier
- Defined in:
- lib/shell_mock/call_verifier.rb
Instance Method Summary collapse
- #failure_message ⇒ Object
- #failure_message_when_negated ⇒ Object
- #fewer_than(n) ⇒ Object (also: #less_than)
-
#initialize ⇒ CallVerifier
constructor
A new instance of CallVerifier.
- #matches?(command_stub) ⇒ Boolean
- #more_than(n) ⇒ Object
- #never ⇒ Object
- #once ⇒ Object
- #times(n) ⇒ Object
Constructor Details
#initialize ⇒ CallVerifier
Returns a new instance of CallVerifier.
3 4 5 |
# File 'lib/shell_mock/call_verifier.rb', line 3 def initialize more_than(0) end |
Instance Method Details
#failure_message ⇒ Object
40 41 42 |
# File 'lib/shell_mock/call_verifier.rb', line 40 def "#{command_stub.command} was expected." end |
#failure_message_when_negated ⇒ Object
44 45 46 |
# File 'lib/shell_mock/call_verifier.rb', line 44 def "#{command_stub.command} was not expected." end |
#fewer_than(n) ⇒ Object Also known as: less_than
13 14 15 16 17 |
# File 'lib/shell_mock/call_verifier.rb', line 13 def fewer_than(n) match_calls_when { |calls| calls < n } self end |
#matches?(command_stub) ⇒ Boolean
34 35 36 37 38 |
# File 'lib/shell_mock/call_verifier.rb', line 34 def matches?(command_stub) @command_stub = command_stub condition.call(command_stub.calls) end |
#more_than(n) ⇒ Object
20 21 22 23 24 |
# File 'lib/shell_mock/call_verifier.rb', line 20 def more_than(n) match_calls_when { |calls| calls > n } self end |
#never ⇒ Object
30 31 32 |
# File 'lib/shell_mock/call_verifier.rb', line 30 def never times(0) end |
#once ⇒ Object
26 27 28 |
# File 'lib/shell_mock/call_verifier.rb', line 26 def once times(1) end |
#times(n) ⇒ Object
7 8 9 10 11 |
# File 'lib/shell_mock/call_verifier.rb', line 7 def times(n) match_calls_when { |calls| calls == n } self end |