Sha256: a0a2091e8f5c13d52edd144529b54f30831463803194eb1cac3c70a3c6b318c9
Contents?: true
Size: 764 Bytes
Versions: 2
Compression:
Stored size: 764 Bytes
Contents
require 'rspec/matchers' # @see http://rubygems.org/gems/rspec require 'json-schema' require 'jsonpath' RSpec::Matchers.define :match_json_schema do |schema| match do |actual| @error_message = JSON::Validator.fully_validate(schema, actual, validate_schema: true).join("") @error_message.empty? end failure_message do |actual| @error_message + "\nActual: #{actual.to_json(JSON::LD::JSON_STATE)}" + "\nSchema: #{schema.to_json(JSON::LD::JSON_STATE)}" end end RSpec::Matchers.define :match_json_path do |path| match do |actual| matched = JsonPath.new(path).on(actual) !matched.empty? end failure_message do |actual| "Path #{path} not found in data" + "\nActual: #{actual.to_json(JSON::LD::JSON_STATE)}" end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
rdf-vocab-2.0.2 | spec/matchers.rb |
rdf-vocab-2.0.1 | spec/matchers.rb |