Helpers#parse_json to not parse unless a String #30

Closed
wants to merge 1 commit into
from

Conversation

Projects
None yet
2 participants

Hi,

I currently have a setup that had a last_json method already implemented before migrating to json_spec for cucumber testing. The method already returned a parsed JSON, which is not compatible since json_spec wants to parse it again from a string.

I committed a change to only parse the JSON in case it's a string (else return the given option). I can't see a reason why last_json should only be the last_response.body string (or similar) and not already a Hash/Array.

Would that be something you could merge into the main branch?

Best,
Rudi

Contributor

laserlemon commented Jun 5, 2012

Thanks for your work, Rudolf. I like the idea but I would like to see at least another higher level test for this. Because there's been no contract that last_json will always be run through parse_json (although that seems to be the case right now), we need to ensure that each of the matchers work properly when fed Ruby rather than JSON. Make sense? Thanks again!

@laserlemon laserlemon closed this Oct 3, 2012

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