class Mocha::ParameterMatchers::HasValue

Parameter matcher which matches when actual parameter contains Hash entry with expected value.

Public Class Methods

new(value) click to toggle source

@private

# File lib/mocha/parameter_matchers/has_value.rb, line 31
def initialize(value)
  @value = value
end

Public Instance Methods

matches?(available_parameters) click to toggle source

@private

# File lib/mocha/parameter_matchers/has_value.rb, line 36
def matches?(available_parameters)
  parameter = available_parameters.shift
  return false unless parameter.respond_to?(:values)
  parameter.values.any? { |value| @value.to_matcher.matches?([value]) }
end
mocha_inspect() click to toggle source

@private

# File lib/mocha/parameter_matchers/has_value.rb, line 43
def mocha_inspect
  "has_value(#{@value.mocha_inspect})"
end