Skip to content

Instantly share code, notes, and snippets.

@hfabre
Created November 23, 2017 15:51
Show Gist options
  • Save hfabre/10a90d20ee944ddd59b46a9e868653e0 to your computer and use it in GitHub Desktop.
Save hfabre/10a90d20ee944ddd59b46a9e868653e0 to your computer and use it in GitHub Desktop.
Deeply test json response with json entry
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