Sha256: 611a3b1103b722747a0544d8aeb68c30b056076f3d9316291b41c5299d0b9013

Contents?: true

Size: 876 Bytes

Versions: 1

Compression:

Stored size: 876 Bytes

Contents

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

      subject{ op.type_check }

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

        it{ should eq(op.heading) }
      end

      context 'when invalid ordering' do
        let(:op){ 
          rank(suppliers, [[:foo, :asc]], :rank)
        }

        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){ 
          rank(suppliers, [[:name, :asc]], :name)
        }

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