Sha256: 9d320cbc89c6e058e9aaee13866aab9290f7fd6756059b5267d8e2aaeff30748

Contents?: true

Size: 903 Bytes

Versions: 1

Compression:

Stored size: 903 Bytes

Contents

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

      subject{ op.type_check }

      context 'when ok' do
        let(:op){ 
          clip(suppliers, [:sid, :name])
        }

        it{ should eq(op.heading) }
      end

      context 'when clipping unexisting attribute' do
        let(:op){ 
          clip(suppliers, [:sid, :unknown])
        }

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

      context 'when clipping unexisting attributes' do
        let(:op){ 
          clip(suppliers, [:sid, :foo, :bar])
        }

        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/clip/test_type_check.rb