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
  match_calls_when { |calls| calls.any? }
end

Instance Method Details

#failure_messageObject



13
14
15
# File 'lib/shell_mock/call_verifier.rb', line 13

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

#failure_message_when_negatedObject



17
18
19
# File 'lib/shell_mock/call_verifier.rb', line 17

def failure_message_when_negated
  "#{actual.command} was not expected."
end

#fewer_than(n) ⇒ Object Also known as: less_than



35
36
37
38
39
# File 'lib/shell_mock/call_verifier.rb', line 35

def fewer_than(n)
  match_calls_when { |calls| calls.size < n }

  self
end

#matches?(actual) ⇒ Boolean

Returns:

  • (Boolean)


7
8
9
10
11
# File 'lib/shell_mock/call_verifier.rb', line 7

def matches?(actual)
  @actual = actual

  condition.call(actual.calls)
end

#more_than(n) ⇒ Object



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

def more_than(n)
  match_calls_when { |calls| calls.size > n }

  self
end

#neverObject



25
26
27
# File 'lib/shell_mock/call_verifier.rb', line 25

def never
  times(0)
end

#onceObject



21
22
23
# File 'lib/shell_mock/call_verifier.rb', line 21

def once
  times(1)
end

#times(n) ⇒ Object



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

def times(n)
  match_calls_when { |calls| calls.size == n }

  self
end