Class: Mocha::ParameterMatchers::Includes

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

Overview

:nodoc:

Instance Method Summary collapse

Methods inherited from Base

#&, #to_matcher, #|

Constructor Details

#initialize(item) ⇒ Includes

Returns a new instance of Includes.



23
24
25
# File 'lib/mocha/parameter_matchers/includes.rb', line 23

def initialize(item)
  @item = item
end

Instance Method Details

#matches?(available_parameters) ⇒ Boolean

Returns:

  • (Boolean)


27
28
29
30
31
# File 'lib/mocha/parameter_matchers/includes.rb', line 27

def matches?(available_parameters)
  parameter = available_parameters.shift
  return false unless parameter.respond_to?(:include?)
  return parameter.include?(@item)
end

#mocha_inspectObject



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

def mocha_inspect
  "includes(#{@item.mocha_inspect})"
end