Sha256: 7490743c96137f2d3ae8d603baed0515ee12f25ce2c0682daaef1f4900c5a3ab

Contents?: true

Size: 952 Bytes

Versions: 3

Compression:

Stored size: 952 Bytes

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

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
finitio-0.5.2 spec/heading/test_multi.rb
finitio-0.5.1 spec/heading/test_multi.rb
finitio-0.5.0 spec/heading/test_multi.rb