Method: WebMock::API#hash_including

Defined in:
lib/webmock/api.rb

#hash_including(*args) ⇒ Object

Similar to RSpec::Mocks::ArgumentMatchers#hash_including()

Matches a hash that includes the specified key(s) or key/value pairs. Ignores any additional keys.

Examples:


object.should_receive(:message).with(hash_including(:key => val))
object.should_receive(:message).with(hash_including(:key))
object.should_receive(:message).with(hash_including(:key, :key2 => val2))


51
52
53
54
55
56
57
# File 'lib/webmock/api.rb', line 51

def hash_including(*args)
  if defined?(super)
    super
  else
    WebMock::Matchers::HashIncludingMatcher.new(anythingize_lonely_keys(*args))
  end
end