class JsonTest::Matchers::HaveJsonPath

Public Class Methods

new(path) click to toggle source
# File lib/jsontest/matchers/have_json_path.rb, line 6
def initialize(path)
  @path = path
end

Public Instance Methods

description() click to toggle source
# File lib/jsontest/matchers/have_json_path.rb, line 27
def description
  %(have JSON path "#{@path}")
end
failure_message() click to toggle source
# File lib/jsontest/matchers/have_json_path.rb, line 17
def failure_message
  %(Expected JSON path "#{@path}")
end
Also aliased as: failure_message_for_should
failure_message_for_should()
Alias for: failure_message
failure_message_for_should_not()
failure_message_when_negated() click to toggle source
# File lib/jsontest/matchers/have_json_path.rb, line 22
def failure_message_when_negated
  %(Expected no JSON path "#{@path}")
end
matches?(json) click to toggle source
# File lib/jsontest/matchers/have_json_path.rb, line 10
def matches?(json)
  parse_json(json, @path)
  true
rescue JsonTest::MissingPath
  false
end