collectiveidea / json_spec

Easily handle JSON in RSpec and Cucumber
rubygems.org/gems/json_spec
MIT License
919 stars 114 forks source link

Make include_json a subset relation #62

Closed myitcv closed 10 years ago

myitcv commented 10 years ago

Rewrite of #61 which included a wrong branch name and commit message

charlierudolph commented 10 years ago

Since you are looking for specifically a subset test, how about a new matcher instead of adding this into the include_json matcher. Maybe have_json_subset which returns false if actual is not a hash, otherwise returns whether or not expected is a subset of actual. The matcher should also allow at_path like a few of the other matchers. What do you think?

myitcv commented 10 years ago

Sounds good. I suspect that's probably the best way to go if you want to retain the include semantics.

Want me to go ahead and add the implementation to my pull request?

myitcv commented 10 years ago

Actually, probably makes more sense to close this PR and create another one with correct naming (given that we are no longer going to modify include_json)

charlierudolph commented 10 years ago

Yeah, probably cleaner as a fresh PR. Thank you.