class RSpec::Oj::Matchers::HaveJsonPath

Public Class Methods

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

Public Instance Methods

description() click to toggle source
# File lib/rspec/oj/matchers/have_json_path.rb, line 30
def description
  %(have JSON path "#{@path}")
end
failure_message() click to toggle source
# File lib/rspec/oj/matchers/have_json_path.rb, line 20
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/rspec/oj/matchers/have_json_path.rb, line 25
def failure_message_when_negated
  %(Expected no JSON path "#{@path}")
end
matches?(json) click to toggle source
# File lib/rspec/oj/matchers/have_json_path.rb, line 13
def matches?(json)
  parse_json(json, @path)
  true
rescue RSpec::Oj::MissingPath
  false
end