Sha256: dea2858775dc6564c85f7c472299fee221d4b257f1f7e3ff37c6b7c1c2b0501f

Contents?: true

Size: 993 Bytes

Versions: 9

Compression:

Stored size: 993 Bytes

Contents

require 'spec_helper'

describe Lurker::Json::Attribute do
  let(:klass) { described_class }

  describe '#parse_schema' do
    context 'when schema is boolean attribute' do
      let(:attribute) do
        klass.new(
          'description' => '',
          'type' => 'boolean',
          'example' => false
        )
      end
      let(:expected) do
        {
          'description' => '',
          'type' => 'boolean',
          'example' => false
        }
      end

      it { expect(attribute.to_hash).to eq expected }
    end

    context 'when default attributes order are broken by user' do
      let(:attribute) do
        klass.new(
          'example' => 'razum2um',
          'description' => '',
          'type' => 'string'
        )
      end
      let(:expected) do
        {
          'example' => 'razum2um',
          'description' => '',
          'type' => 'string'
        }.to_json
      end

      it { expect(attribute.to_json).to eq expected }
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
lurker-1.0.0 spec/lurker/json/attribute_spec.rb
lurker-0.6.12 spec/lurker/json/attribute_spec.rb
lurker-0.6.11 spec/lurker/json/attribute_spec.rb
lurker-0.6.10 spec/lurker/json/attribute_spec.rb
lurker-0.6.9 spec/lurker/json/attribute_spec.rb
lurker-0.6.8 spec/lurker/json/attribute_spec.rb
lurker-0.6.7 spec/lurker/json/attribute_spec.rb
lurker-0.6.6 spec/lurker/json/attribute_spec.rb
lurker-0.6.5 spec/lurker/json/attribute_spec.rb