Class: ShellMock::CallVerifier

Inherits:
Object
  • Object
show all
Defined in:
lib/shell_mock/call_verifier.rb

Instance Method Summary collapse

Constructor Details

#initializeCallVerifier

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_messageObject



40
41
42
# File 'lib/shell_mock/call_verifier.rb', line 40

def failure_message
  "#{command_stub.command} was expected."
end

#failure_message_when_negatedObject



44
45
46
# File 'lib/shell_mock/call_verifier.rb', line 44

def failure_message_when_negated
  "#{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

Returns:

  • (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

#neverObject



30
31
32
# File 'lib/shell_mock/call_verifier.rb', line 30

def never
  times(0)
end

#onceObject



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