Method: RSpec::Mocks::ArgumentMatchers#hash_including

Defined in:
lib/rspec/mocks/argument_matchers.rb

- (Object) hash_including(*args)

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

Examples:


expect(object).to receive(:message).with(hash_including(:key => val))
expect(object).to receive(:message).with(hash_including(:key))
expect(object).to receive(:message).with(hash_including(:key, :key2 => val2))


68
69
70
# File 'lib/rspec/mocks/argument_matchers.rb', line 68

def hash_including(*args)
  HashIncludingMatcher.new(ArgumentMatchers.anythingize_lonely_keys(*args))
end

Comments