Sha256: 86d07414d2c2fcf00b40e28118335a24bf9f84e15fa73041e8ec709c7e23fde0

Contents?: true

Size: 1.06 KB

Versions: 2

Compression:

Stored size: 1.06 KB

Contents

require 'spec_helper'

describe SchemaTools::Reader do
  BROKEN_SCHEMA_PATH = File.expand_path('../../fixtures_broken', __FILE__)
  context 'circular references' do
    it 'should raise exception for circular $refs' do
      expect{
        schema = SchemaTools::Schema.new("#{BROKEN_SCHEMA_PATH}/circular_references.json")
      }.to raise_exception(SchemaTools::CircularReferenceException)
    end
    it 'should raise exception for more complex circular $refs' do
      expect{
        schema = SchemaTools::Schema.new("#{BROKEN_SCHEMA_PATH}/circular_references_multi.json")
      }.to raise_exception(SchemaTools::CircularReferenceException)
    end
    it 'should raise exception for way multi file circular $refs' do
      expect {
        schema = SchemaTools::Schema.new("#{BROKEN_SCHEMA_PATH}/circular_references_multi_file_one.json")
      }.to raise_exception
    end
    it 'should not raise exception if same $ref is used twice in one file' do
      expect {
        SchemaTools::Reader.read(:circular_references_twice)
      }.to_not raise_exception
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
json_schema_tools-0.4.0 spec/schema_tools/circuluar_ref_spec.rb
json_schema_tools-0.3.3 spec/schema_tools/circuluar_ref_spec.rb