Class: Mocha::ParameterMatchers::Not

Inherits:
Base show all
Defined in:
lib/mocha/parameter_matchers/not.rb

Overview

Parameter matcher which inverts the logic of the specified matcher using a logical NOT operation.

Instance Method Summary collapse

Methods inherited from Base

#&, #to_matcher, #|

Constructor Details

#initialize(matcher) ⇒ Not

Returns a new instance of Not


33
34
35
# File 'lib/mocha/parameter_matchers/not.rb', line 33

def initialize(matcher)
  @matcher = matcher
end

Instance Method Details

#matches?(available_parameters) ⇒ Boolean

Returns:

  • (Boolean)

38
39
40
41
# File 'lib/mocha/parameter_matchers/not.rb', line 38

def matches?(available_parameters)
  parameter = available_parameters.shift
  !@matcher.matches?([parameter])
end

#mocha_inspectObject


44
45
46
# File 'lib/mocha/parameter_matchers/not.rb', line 44

def mocha_inspect
  "Not(#{@matcher.mocha_inspect})"
end