Sha256: dbdad8fa5cd0cbb40b397bc4f137967882a9aefe816413ccd7f7164ba0ef54ed

Contents?: true

Size: 919 Bytes

Versions: 1

Compression:

Stored size: 919 Bytes

Contents

require 'type_check_helper'
module Alf
  module Algebra
    describe Coerce, 'type_check' do

      subject{ op.type_check }

      context 'when ok' do
        let(:op){ 
          coerce(suppliers, sid: Float)
        }

        it{ should eq(op.heading) }
      end

      context 'when unexisting attribute' do
        let(:op){ 
          coerce(suppliers, sid: Float, unknown: String)
        }

        it 'should raise an error' do
          lambda{
            subject
          }.should raise_error(TypeCheckError, /no such attribute `unknown`/)
        end
      end

      context 'when unexisting attributes' do
        let(:op){ 
          coerce(suppliers, sid: Float, foo: String, bar: String)
        }

        it 'should raise an error' do
          lambda{
            subject
          }.should raise_error(TypeCheckError, /no such attributes `foo`,`bar`/)
        end
      end

    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
alf-core-0.15.0 spec/unit/alf-algebra/operator/coerce/test_type_check.rb