class Mocha::ParameterMatchers::Includes

Parameter matcher which matches when actual parameter includes expected values.

def initialize(*items)

Other tags:
    Private: -
def initialize(*items)
  @items = items
end

def matches?(available_parameters)

Other tags:
    Private: -
def matches?(available_parameters)
  parameter = available_parameters.shift
  return false unless parameter.respond_to?(:include?)
  if @items.size == 1
    # rubocop:disable Style/GuardClause
    if parameter.respond_to?(:any?) && !parameter.is_a?(String)
      parameter = parameter.keys if parameter.is_a?(Hash)
      return parameter.any? { |p| @items.first.to_matcher.matches?([p]) }
    else
      return parameter.include?(@items.first)
    end
    # rubocop:enable Style/GuardClause
  else
    includes_matchers = @items.map { |item| Includes.new(item) }
    AllOf.new(*includes_matchers).matches?([parameter])
  end
end

def mocha_inspect

Other tags:
    Private: -
def mocha_inspect
  item_descriptions = @items.map(&:mocha_inspect)
  "includes(#{item_descriptions.join(', ')})"
end