Sha256: e22cd3be58842dffe369ea08a4efe20d86beab9d7554dde9ecfeb069b59c690a

Contents?: true

Size: 1.14 KB

Versions: 16

Compression:

Stored size: 1.14 KB

Contents

require 'spec_helper'
module Finitio
  describe Heading, "allow_extra? and allow_extra" do

    let(:r){ Attribute.new(:r, intType) }

    def heading(attributes, options = nil)
      Heading.new(attributes, options)
    end

    it 'is false by default' do
      expect(heading([r])).not_to be_allow_extra
      expect(heading([r]).allow_extra).to be_nil
      expect(heading([r]).extra_type).to be_nil
    end

    it 'can be set to true' do
      expect(heading([r], allow_extra: true)).to be_allow_extra
      expect(heading([r], allow_extra: true).allow_extra).to eq(anyType)
      expect(heading([r], allow_extra: true).extra_type).to eq(anyType)
    end

    it 'can be set to false explicitely' do
      expect(heading([r], allow_extra: false)).not_to be_allow_extra
      expect(heading([r]).allow_extra).to be_nil
      expect(heading([r]).extra_type).to be_nil
    end

    it 'can be set to an explicit type' do
      expect(heading([r], allow_extra: intType)).to be_allow_extra
      expect(heading([r], allow_extra: intType).allow_extra).to eql(intType)
      expect(heading([r], allow_extra: intType).extra_type).to eql(intType)
    end

  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
finitio-0.12.0 spec/heading/test_allow_extra.rb
finitio-0.11.4 spec/heading/test_allow_extra.rb
finitio-0.11.3 spec/heading/test_allow_extra.rb
finitio-0.11.2 spec/heading/test_allow_extra.rb
finitio-0.11.1 spec/heading/test_allow_extra.rb
finitio-0.10.0 spec/heading/test_allow_extra.rb
finitio-0.9.1 spec/heading/test_allow_extra.rb
finitio-0.9.0 spec/heading/test_allow_extra.rb
finitio-0.8.0 spec/heading/test_allow_extra.rb
finitio-0.7.0 spec/heading/test_allow_extra.rb
finitio-0.7.0.pre.rc4 spec/heading/test_allow_extra.rb
finitio-0.7.0.pre.rc3 spec/heading/test_allow_extra.rb
finitio-0.7.0.pre.rc2 spec/heading/test_allow_extra.rb
finitio-0.7.0.pre.rc1 spec/heading/test_allow_extra.rb
finitio-0.6.1 spec/heading/test_allow_extra.rb
finitio-0.6.0 spec/heading/test_allow_extra.rb