Created
November 23, 2017 15:51
-
-
Save hfabre/10a90d20ee944ddd59b46a9e868653e0 to your computer and use it in GitHub Desktop.
Deeply test json response with json entry
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def deeply_validate_json_response(entry, out) | |
entry.each do |k, v| | |
if v.is_a? Hash | |
deeply_validate_json_response(v, out[k.to_s]) | |
elsif v.is_a? Array | |
v.each { |obj| deeply_validate_json_response(obj, out[k.to_s]) } | |
else | |
v.must_equal out[k.to_s] | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment