Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Provide json_equivalent parameter matcher (similar to yaml_equivalent) #36

Closed
wants to merge 2 commits into
from

Conversation

Projects
None yet
3 participants

boosty commented Sep 21, 2011

In tests I often have the need of expecting parameters in JSON format. That's why I added a json_equivalent parameter matcher, similar to the existing yaml_equivalent.

Please note that this introduces a gem dependency on the json gem. Using a different JSON gem would certainly be possible.

Might consider multi_json?

boosty commented Oct 21, 2011

Yes, good idea! Will do.

Use multi_json instead of concrete json lib
Also get rid of unnecessary json encode/decode 
sequence.
Owner

floehopper commented Dec 26, 2011

Thanks for the pull request. Sorry not to have replied to this sooner. My immediate reaction was that I don't really want to introduce a dependency on another gem just for this matcher. The YAML matcher is different in that it only depends on the standard library in Ruby 1.8.7. But I notice that JSON is available in the Ruby 1.9.2 standard library, so I'll give this some more thought. One solution might be not to explicitly load the JSON matcher by default, so a developer has to explicitly load it. What do you think?

boosty commented Dec 27, 2011

Thanks for the feedback!

I think you are right, adding a gem dependency just for this matcher seems a bit too much.

A helpful message when using the matcher without the gem being installed would be my idea. Will try to come with some code in the next days.

Owner

floehopper commented Dec 29, 2013

In the absence of a version which doesn't introduce a dependency on a JSON gem, I'm closing this. Thanks.

@floehopper floehopper closed this Dec 29, 2013

floehopper referenced this pull request in mrsimo/mocha Mar 7, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment