Sha256: 0a2227d40a242549b3d6ce6d6f2e457061696ff5c821022b7b45a141a611a05a

Contents?: true

Size: 619 Bytes

Versions: 2

Compression:

Stored size: 619 Bytes

Contents

require 'spec_helper'
module Finitio
  describe BuiltinType, "dress" do

    let(:type){ BuiltinType.new(Integer, 'int') }

    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 }

      subject{
        type.dress(arg) rescue $!
      }

      it 'should raise an Error' do
        subject.should be_a(TypeError)
        subject.message.should eq("Invalid value `12.0` for int")
      end

      it 'should have no location' do
        subject.location.should eq('')
      end
    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
finitio-0.4.1 spec/unit/type/builtin_type/test_dress.rb
finitio-0.4.0 spec/unit/type/builtin_type/test_dress.rb