Class Index [+]

Quicksearch

Mocha::ParameterMatchers::HasKey

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

Public Class Methods

new(key) click to toggle source

@private

    # File lib/mocha/parameter_matchers/has_key.rb, line 33
33:       def initialize(key)
34:         @key = key
35:       end

Public Instance Methods

matches?(available_parameters) click to toggle source

@private

    # File lib/mocha/parameter_matchers/has_key.rb, line 38
38:       def matches?(available_parameters)
39:         parameter = available_parameters.shift
40:         return false unless parameter.respond_to?(:keys)
41:         parameter.keys.any? { |key| @key.to_matcher.matches?([key]) }
42:       end
mocha_inspect() click to toggle source

@private

    # File lib/mocha/parameter_matchers/has_key.rb, line 45
45:       def mocha_inspect
46:         "has_key(#{@key.mocha_inspect})"
47:       end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.