Sha256: cfcfd99722f39aa405a1156701184d6e372ed7533c672d2f5102fbaa17d26b65
Contents?: true
Size: 643 Bytes
Versions: 5
Compression:
Stored size: 643 Bytes
Contents
require 'test/unit' require File.dirname(__FILE__) + '/../lib/json-schema' class ListOptionTest < Test::Unit::TestCase def test_list_option_reusing_schemas schema_hash = { "$schema" => "http://json-schema.org/draft-04/schema#", "type" => "object", "properties" => { "a" => { "type" => "integer" } } } uri = URI.parse('http://example.com/item') schema = JSON::Schema.new(schema_hash, uri) JSON::Validator.add_schema(schema) data = {"a" => 1} assert(JSON::Validator.validate(uri.to_s, data)) data = [{"a" => 1}] assert(JSON::Validator.validate(uri.to_s, data, :list => true)) end end
Version data entries
5 entries across 5 versions & 1 rubygems