Sha256: 3e99b337db0958c9f2fcaf4a004d13e52f6135bde9166342a5971e2577c0e1fe

Contents?: true

Size: 971 Bytes

Versions: 19

Compression:

Stored size: 971 Bytes

Contents

require 'spec_helper'

RSpec.describe JSON::SchemaBuilder::Object, type: :unit do
  subject{ described_class }

  it{ is_expected.to define_attribute :required }
  it{ is_expected.to define_attribute :min_properties }
  it{ is_expected.to define_attribute :max_properties }
  it{ is_expected.to define_attribute :properties }
  it{ is_expected.to define_attribute :additional_properties }
  it{ is_expected.to define_attribute :pattern_properties }
  its(:registered_type){ is_expected.to eql :object }

  describe '#initialize' do
    subject do
      described_class.new 'name' do
        string :test1
        string :test2
      end
    end

    let(:string){ kind_of JSON::SchemaBuilder::String }
    its(:children){ is_expected.to include string }
    its('children.length'){ is_expected.to eql 2 }
    its('properties'){ is_expected.to include test1: { 'type' => 'string' } }
    its('properties'){ is_expected.to include test2: { 'type' => 'string' } }
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
json-schema_builder-0.7.0 spec/unit/object_spec.rb
json-schema_builder-0.6.1 spec/unit/object_spec.rb
json-schema_builder-0.6.0 spec/unit/object_spec.rb
json-schema_builder-0.5.0 spec/unit/object_spec.rb
json-schema_builder-0.4.0 spec/unit/object_spec.rb
json-schema_builder-0.3.1 spec/unit/object_spec.rb
json-schema_builder-0.3.0 spec/unit/object_spec.rb
json-schema_builder-0.2.1 spec/unit/object_spec.rb
json-schema_builder-0.2.0 spec/unit/object_spec.rb
json-schema_builder-0.1.0 spec/unit/object_spec.rb
json-schema_builder-0.0.9 spec/unit/object_spec.rb
json-schema_builder-0.0.8 spec/unit/object_spec.rb
json-schema_builder-0.0.7 spec/unit/object_spec.rb
json-schema_builder-0.0.6 spec/unit/object_spec.rb
json-schema_builder-0.0.5 spec/unit/object_spec.rb
json-schema_builder-0.0.4 spec/unit/object_spec.rb
json-schema_builder-0.0.3 spec/unit/object_spec.rb
json-schema_builder-0.0.2 spec/unit/object_spec.rb
json-schema_builder-0.0.1 spec/unit/object_spec.rb