Sha256: ef38bd246df793103beb09e4f6068d9a4b57ce1a221c6e8d075c47d63b8bc02a

Contents?: true

Size: 727 Bytes

Versions: 3

Compression:

Stored size: 727 Bytes

Contents

require 'json'

describe JSON, 'All JSON Schemas' do
  it 'should conform to JSON Schema' do
    schema = File.open('schema/schema.json', 'rb'){|f| JSON.parse(f.read)}
    Dir.glob('schema/*.json').each do |schema_file|
      if schema_file != 'schema/schema.json' # Don't check the schema itself
       data = File.open(schema_file, 'rb'){|f| JSON.parse(f.read)}
       JSON::Schema.validate(data, schema)
      end
    end
  end
end

describe JSON, 'Result Example' do 
  it 'should conform to the schema defined' do
    schema = File.open('schema/result.json', 'rb'){|f| JSON.parse(f.read)}
    data = File.open('fixtures/result_example.json', 'rb'){|f| JSON.parse(f.read)}
    JSON::Schema.validate(data, schema)
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
quality-measure-engine-0.1.2 spec/schema_spec.rb
quality-measure-engine-0.1.1 spec/schema_spec.rb
quality-measure-engine-0.1.0 spec/schema_spec.rb