collectiveidea/json_spec — pull request #57 by ryansch (2013-11-14 21:56:52+00:00)
Title: Add #only to whitelist keys

In my integration request specs, I sometimes want to find out if a json response contains objects with specific ids. With the existing interface I have to go through and explicitly blacklist all of the other keys. I instead added a whitelist with the #only method.

Example:

```ruby
# include_json
%([{"id":1,"json":"spec"}]).should include_json(%({"id":1})).only(:id)

# be_json_eql
%({"id":1,"json":"spec"}).should be_json_eql(%({"id":1})).only(:id)
```

The actual json responses I'm comparing have far more keys.