Sha256: ec5b5f738a5302e0539a8d04d2bea33bff6b5d822eb5e79409856249f6b5abd0
Contents?: true
Size: 1.24 KB
Versions: 2
Compression:
Stored size: 1.24 KB
Contents
require 'test/unit' require File.dirname(__FILE__) + '/../lib/json-schema' class RubySchemaTest < Test::Unit::TestCase def test_string_keys schema = { "type" => 'object', "required" => ["a"], "properties" => { "a" => {"type" => "integer", "default" => 42}, "b" => {"type" => "integer"} } } data = { "a" => 5 } assert(JSON::Validator.validate(schema, data)) end def test_symbol_keys schema = { :type => 'object', :required => ["a"], :properties => { :a => {:type => "integer", :default => 42}, :b => {:type => "integer"} } } data = { :a => 5 } assert(JSON::Validator.validate(schema, data)) end def test_symbol_keys_in_hash_within_array schema = { :type => 'object', :properties => { :a => { :type => "array", :items => [ { :properties => { :b => { :type => "integer" } } } ] } } } data = { :a => [ { :b => 1 } ] } assert(JSON::Validator.validate(schema, data, :validate_schema => true)) end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
json-schema-2.4.1 | test/test_ruby_schema.rb |
json-schema-2.4.0 | test/test_ruby_schema.rb |