Sha256: 156da8efa415617b23f5ef3e796f2716ee2cc5f70c70d52398c9a5192d6ffd5c

Contents?: true

Size: 509 Bytes

Versions: 4

Compression:

Stored size: 509 Bytes

Contents

require 'spec_helper'
module Alf
  module Types
    describe Size, "coerce" do

      it 'should coerce strings correctly' do
        Size.coerce("0").should eq(0)
        Size.coerce("10").should eq(10)
      end

      it 'should raise TypeError on negative integers' do
        lambda{ Size.coerce("-1") }.should raise_error(TypeError)
      end

      it 'should raise on non integers' do
        lambda{
          Size.coerce("hello")
        }.should raise_error(TypeError)
      end

    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
alf-core-0.15.0 spec/unit/alf-types/size/test_coerce.rb
alf-core-0.14.0 spec/unit/alf-types/size/test_coerce.rb
alf-core-0.13.1 spec/unit/alf-types/size/test_coerce.rb
alf-core-0.13.0 spec/unit/alf-types/size/test_coerce.rb