Sha256: 129102b6de1415e01ffad6bd005c813cd4b18e4244e25aae6bc9767f4dd5f189

Contents?: true

Size: 557 Bytes

Versions: 2

Compression:

Stored size: 557 Bytes

Contents

require 'spec_helper'
module Finitio
  describe UnionType, "initialize" do

    context 'with valid candidates' do
      let(:union){ UnionType.new([intType, floatType]) }

      it 'sets the variable instances' do
        union.candidates.should eq([intType, floatType])
      end
    end

    context 'with invalid candidates' do
      let(:union){ UnionType.new(["bar"]) }

      it 'should raise an error' do
        ->{
          union
        }.should raise_error(ArgumentError, %Q{[Finitio::Type] expected, got ["bar"]})
      end
    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
finitio-0.4.1 spec/unit/type/union_type/test_initialize.rb
finitio-0.4.0 spec/unit/type/union_type/test_initialize.rb