Sha256: f50498f73dfbfe814572db9d25d35f112e85ef1ae7cbd367c9d261184875c202

Contents?: true

Size: 843 Bytes

Versions: 15

Compression:

Stored size: 843 Bytes

Contents

require File.expand_path(File.dirname(__FILE__) + '/spec_helper')

describe 'Type Check' do

  it 'should raise UnsupportedTypeException exception if value is not of specified type' do
    expect(Type.check(1, Fixnum)).to eq(1)
    expect { Type.check('1', Fixnum) }.to raise_error(UnsupportedTypeException)
  end

  it 'should raise UnsupportedTypeException exception if value does not respond to specified method' do
     expect(Type.responds(1, :even?)).to eq(1)
     expect { Type.responds('1', :even?) }.to raise_error(UnsupportedTypeException)
  end

  it 'should raise UnsupportedTypeException exception if values do not respond to specified method' do
     expect(Type.responds_all(sequence(1,2,3), :to_s)).to eq([1,2,3])
     expect { Type.responds_all(sequence(1,2,3), :is_cool) }.to raise_error(UnsupportedTypeException)
   end

end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
totally_lazy-0.0.20 spec/type_check_spec.rb
totally_lazy-0.0.19 spec/type_check_spec.rb
totally_lazy-0.0.18 spec/type_check_spec.rb
totally_lazy-0.0.16 spec/type_check_spec.rb
totally_lazy-0.0.15 spec/type_check_spec.rb
totally_lazy-0.0.14 spec/type_check_spec.rb
totally_lazy-0.0.13 spec/type_check_spec.rb
totally_lazy-0.0.12 spec/type_check_spec.rb
totally_lazy-0.0.11 spec/type_check_spec.rb
totally_lazy-0.0.10 spec/type_check_spec.rb
totally_lazy-0.0.9 spec/type_check_spec.rb
totally_lazy-0.0.8 spec/type_check_spec.rb
totally_lazy-0.0.7 spec/type_check_spec.rb
totally_lazy-0.0.6 spec/type_check_spec.rb
totally_lazy-0.0.5 spec/type_check_spec.rb