floehopper/mocha — Issue #45: has_entry drops additional has key/values silently
Author: phillc
Created: 2011-12-13 20:13:50+00:00
State: open

has_entry supports testing parameters with a hash, like

```ruby
expects(:thing).with(has_entry(:foo => :bar))
```

However, there may come a time where a developer adds another entry to this hash, and will want to update existing tests to reflect that

```ruby
expects(:thing).with(has_entry(:foo => :bar, :qux => 1))
```

The problem is that has_entry will only respect one on the entries in the hash passed to it. The fix is to use has_entries

```ruby
expects(:thing).with(has_entries(:foo => :bar, :qux => 1))
```

However, this is very easy to overlook.

I want to contribute a patch, however I am wondering if any of these are the right way to go:

* Bring has_entries into has_entry, as I am having a hard time figuring out when one would want to drop the rest of the hash.
* Change the method signature to not allow a hash as a parameter, so that this mistake cannot be made.
* Throw an exception if the hash that was passed in has more than one entry.
* Get over it, fix my own code and don't patch.

Thanks