module Mocha::ParameterMatchers
def has_entry(*options) # rubocop:disable Naming/PredicateName
- Example: Actual parameter does not contain expected entry supplied as +Hash+ entry. -
Example: Actual parameter does not contain expected entry supplied as key and value. -
Example: Actual parameter contains expected entry supplied as +Hash+ entry. -
Example: Actual parameter contains expected entry supplied as key and value. -
Other tags:
- See: Expectation#with -
Returns:
-
(HasEntry)
- parameter matcher.
Raises:
-
(ArgumentError)
- if +single_entry_hash+ does not contain exactly one entry.
Parameters:
-
single_entry_hash
(Hash
) -- +Hash+ with single entry. -
value
(Object
) -- value for entry. -
key
(Object
) -- key for entry.
Overloads:
-
def has_entry(single_entry_hash)
-
def has_entry(key, value)
def has_entry(*options) # rubocop:disable Naming/PredicateName case options.length when 0 raise ArgumentError, 'No arguments. Expecting at least one.' when 1 key, value = parse_option(options[0]) when 2 key, value = options else raise ArgumentError, 'Too many arguments; use either a single argument (must be a Hash) or two arguments (a key and a value).' end HasEntry.new(key, value) end