class Matchers::JSON::DocumentContainsJSONPath
Public Class Methods
new(json_path)
click to toggle source
# File lib/matchers/json/document_contains_json_path.rb, line 6 def initialize(json_path) @json_path = json_path end
Public Instance Methods
matches?(document_s)
click to toggle source
@param document_s [String] - the document given as String Exceptions caught by JSON
Parser will be thrown up the stack ::JSON::ParserError in the case of invalid JSON
# File lib/matchers/json/document_contains_json_path.rb, line 13 def matches?(document_s) json_hash = ::JSON.parse(document_s) !value_on_path(json_hash, @json_path).nil? end