Sha256: 8f17fc5b47abde06ca4d08109590ad735f4ad20358bc42bf04faa9c00d91b24d

Contents?: true

Size: 892 Bytes

Versions: 1

Compression:

Stored size: 892 Bytes

Contents

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

      subject{ op.type_check }

      context 'when ok' do
        let(:op){ 
          extend(suppliers, foo: 12)
        }

        it{ should eq(op.heading) }
      end

      context 'when clash attribute' do
        let(:op){ 
          extend(suppliers, sid: ->{}, foo: 12)
        }

        it 'should raise an error' do
          lambda{
            subject
          }.should raise_error(TypeCheckError, /cannot override `sid`/)
        end
      end

      context 'when unexisting attributes' do
        let(:op){ 
          extend(suppliers, sid: ->{}, name: ->{}, bar: String)
        }

        it 'should raise an error' do
          lambda{
            subject
          }.should raise_error(TypeCheckError, /cannot override `sid`,`name`/)
        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/extend/test_type_check.rb