module Matchers::JSON::JSONPathHasThing
Public Class Methods
new(json_path, json_thing)
click to toggle source
# File lib/matchers/json/json_path_has_thing.rb, line 5 def initialize(json_path, json_thing) @json_path = json_path @json_thing = discriminate json_thing end
Public Instance Methods
matches?(document_s)
click to toggle source
# File lib/matchers/json/json_path_has_thing.rb, line 10 def matches?(document_s) json_doc_hash = ::JSON.parse document_s value_on_path(json_doc_hash, @json_path) == @json_thing end
Private Instance Methods
discriminate(thing)
click to toggle source
# File lib/matchers/json/json_path_has_thing.rb, line 16 def discriminate(thing) return thing if [Array, Hash].include? thing.class ::JSON.parse thing end