Sha256: b172ec4c4c6ceba11dc26af84b98f6f36c80f0f429f87983f72b68a921a99ab6

Contents?: true

Size: 615 Bytes

Versions: 3

Compression:

Stored size: 615 Bytes

Contents

require 'spec_helper'
module Qrb
  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

3 entries across 3 versions & 1 rubygems

Version Path
qrb-0.3.0 spec/unit/type/builtin_type/test_dress.rb
qrb-0.2.0 spec/unit/type/builtin_type/test_dress.rb
qrb-0.1.0 spec/unit/type/builtin_type/test_dress.rb