Sha256: 6b5850335a87730f1cde4b5eded4c4155e8d0b9ce43c96f73bfe2474862a06ea

Contents?: true

Size: 1.13 KB

Versions: 16

Compression:

Stored size: 1.13 KB

Contents

require 'spec_helper'
module Finitio
  describe Heading, "multi?" do

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

    let(:blue){
      Attribute.new(:blue, floatType)
    }

    let(:maybe_blue){
      Attribute.new(:blue, floatType, false)
    }

    subject{ Heading.new(attributes, options).multi? }

    let(:options){ nil }

    context 'with no attribute' do
      let(:attributes){
        [ ]
      }

      it{ should eq(false) }
    end

    context 'with required attributes only' do
      let(:attributes){
        [ red, blue ]
      }

      it{ should eq(false) }
    end

    context 'with some optional attributes' do
      let(:attributes){
        [ red, maybe_blue ]
      }

      it{ should eq(true) }
    end

    context 'with allow_extra set to true' do
      let(:attributes){
        [ red, blue ]
      }
      let(:options){
        {allow_extra: true}
      }

      it{ should eq(true) }
    end

    context 'with allow_extra set to a type' do
      let(:attributes){
        [ red, blue ]
      }
      let(:options){
        {allow_extra: intType}
      }

      it{ should eq(true) }
    end

  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

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