Sha256: aa88ab471ee4b24be7f6eacdae78af0621cb0364463c8c579566eec74b24a8de
Contents?: true
Size: 584 Bytes
Versions: 1
Compression:
Stored size: 584 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 elsif @expected_including_text node.to_s.include?(@expected_including_text) else node.present? end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
api_matchers-0.1.0 | lib/api_matchers/response_body/have_json_node.rb |