class Object

Public Instance Methods

traverse(expected, actual, negate=false) click to toggle source
# File lib/rspec/json_expectations/matchers.rb, line 4
def traverse(expected, actual, negate=false)
  unless expected.is_a?(Hash) ||
      expected.is_a?(Array) ||
      expected.is_a?(::RSpec::JsonExpectations::Matchers::UnorderedArrayMatcher)
    raise ArgumentError,
      "Expected value must be a json for include_json matcher"
  end

  representation = actual
  representation = JSON.parse(actual) if String === actual

  RSpec::JsonExpectations::JsonTraverser.traverse(
    @include_json_errors = { _negate: negate },
    expected,
    representation,
    negate
  )
end