Sha256: 7165a4a8082302b27245e80f7393e1ce43d79a2675043fdedc2f54c20fffba2e
Contents?: true
Size: 490 Bytes
Versions: 2
Compression:
Stored size: 490 Bytes
Contents
require 'json' require 'active_support/core_ext/hash' module APIMatchers module ResponseBody class HaveJsonNode < Base def matches?(actual) @actual = actual json = begin JSON.parse(response_body) rescue {} end node = Core::FindInJSON.new(json).find(node: @expected_node.to_s) if @with_value node.to_s == @with_value.to_s else node.present? end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
api_matchers-0.0.2 | lib/api_matchers/response_body/have_json_node.rb |
api_matchers-0.0.1 | lib/api_matchers/response_body/have_json_node.rb |