class ShellMock::RunVerifier

Attributes

command_stub[R]
condition[R]

Public Class Methods

new() click to toggle source
# File lib/shell_mock/run_verifier.rb, line 3
def initialize
  more_than(0)
end

Public Instance Methods

failure_message() click to toggle source
# File lib/shell_mock/run_verifier.rb, line 40
def failure_message
  "#{command_stub.command} was expected."
end
failure_message_when_negated() click to toggle source
# File lib/shell_mock/run_verifier.rb, line 44
def failure_message_when_negated
  "#{command_stub.command} was not expected."
end
fewer_than(n) click to toggle source
# File lib/shell_mock/run_verifier.rb, line 13
def fewer_than(n)
  match_runs_when { |runs| runs < n }

  self
end
Also aliased as: less_than
less_than(n)
Alias for: fewer_than
matches?(command_stub) click to toggle source
# File lib/shell_mock/run_verifier.rb, line 34
def matches?(command_stub)
  @command_stub = command_stub

  condition.call(command_stub.runs)
end
more_than(n) click to toggle source
# File lib/shell_mock/run_verifier.rb, line 20
def more_than(n)
  match_runs_when { |runs| runs > n }

  self
end
never() click to toggle source
# File lib/shell_mock/run_verifier.rb, line 30
def never
  times(0)
end
once() click to toggle source
# File lib/shell_mock/run_verifier.rb, line 26
def once
  times(1)
end
times(n) click to toggle source
# File lib/shell_mock/run_verifier.rb, line 7
def times(n)
  match_runs_when { |runs| runs == n }

  self
end

Private Instance Methods

match_runs_when(&blk) click to toggle source
# File lib/shell_mock/run_verifier.rb, line 52
def match_runs_when(&blk)
  @condition = blk
end