Class Index [+]

Quicksearch

Mocha::ParameterMatchers::HasEntry

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

Public Class Methods

new(key, value) click to toggle source

@private

    # File lib/mocha/parameter_matchers/has_entry.rb, line 63
63:       def initialize(key, value)
64:         @key, @value = key, value
65:       end

Public Instance Methods

matches?(available_parameters) click to toggle source

@private

    # File lib/mocha/parameter_matchers/has_entry.rb, line 68
68:       def matches?(available_parameters)
69:         parameter = available_parameters.shift
70:         return false unless parameter.respond_to?(:keys) && parameter.respond_to?(:[])
71:         matching_keys = parameter.keys.select { |key| @key.to_matcher.matches?([key]) }
72:         matching_keys.any? { |key| @value.to_matcher.matches?([parameter[key]]) }
73:       end
mocha_inspect() click to toggle source

@private

    # File lib/mocha/parameter_matchers/has_entry.rb, line 76
76:       def mocha_inspect
77:         "has_entry(#{@key.mocha_inspect} => #{@value.mocha_inspect})"
78:       end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.