Sha256: 32c4a3a9596a305113621e07a32d6c181b11529975c6d62867ec7d0cfca14308
Contents?: true
Size: 895 Bytes
Versions: 19
Compression:
Stored size: 895 Bytes
Contents
require 'spec_helper' module Finitio describe UnionType, "dress" do let(:type){ UnionType.new([intType, floatType], "union") } subject{ type.dress(arg) } context 'with an Integer' do let(:arg){ 12 } it{ should be(arg) } end context 'with a Float' do let(:arg){ 12.0 } it{ should be(arg) } end context 'with a String' do let(:arg){ "foo" } subject{ type.dress(arg) rescue $! } it 'should raise an Error' do expect(subject).to be_a(TypeError) expect(subject.message).to eq("Invalid union `foo`") end it 'should have a cause' do expect(subject.cause).to be_a(TypeError) expect(subject.cause.message).to eq("Invalid intType `foo`") end it 'should have an empty location' do expect(subject.location).to eq('') end end end end
Version data entries
19 entries across 19 versions & 1 rubygems