Sha256: e38de6541c6ebb23458a901e92e3684e93a82b74fef637af632e7628421a62a2

Contents?: true

Size: 1.16 KB

Versions: 1

Compression:

Stored size: 1.16 KB

Contents

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

      subject{ op.type_check }

      context 'when ok' do
        let(:op){ 
          frame(suppliers, [], 2, 4)
        }

        it{ should eq(op.heading) }
      end

      context 'when invalid ordering' do
        let(:op){ 
          frame(suppliers, [[:sid, :asc], [:foo, :asc], [:bar, :asc]], 2, 4)
        }

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

      context 'when negative offset' do
        let(:op){ 
          frame(suppliers, [[:sid, :asc]], -2, 4)
        }

        it 'should raise an error' do
          lambda{
            subject
          }.should raise_error(TypeCheckError, /invalid offset `-2`/)
        end
      end

      context 'when negative limit' do
        let(:op){ 
          frame(suppliers, [[:sid, :asc]], 2, -4)
        }

        it 'should raise an error' do
          lambda{
            subject
          }.should raise_error(TypeCheckError, /invalid limit `-4`/)
        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/frame/test_type_check.rb