Sha256: f3017fbb8b58516c5d056a3d4c33bdc6a2acd69de6bd19f0087de86329a9a7fb

Contents?: true

Size: 849 Bytes

Versions: 1

Compression:

Stored size: 849 Bytes

Contents

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

      subject{ op.type_check }

      context 'when ok' do
        let(:op){ 
          rename(suppliers, name: :sname)
        }

        it{ should eq(op.heading) }
      end

      context 'when invalid renaming' do
        let(:op){ 
          rename(suppliers, foo: :bar)
        }

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

      context 'when name clash' do
        let(:op){ 
          rename(suppliers, name: :sid)
        }

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