Sha256: 74ba44744978e9be896c076a000aa72aacaac8daa325265a800c38c3e3009619

Contents?: true

Size: 799 Bytes

Versions: 2

Compression:

Stored size: 799 Bytes

Contents

require 'spec_helper'
module Alf
  module Algebra
    describe Rank, 'keys' do

      let(:operand){
        an_operand.with_heading(id: Integer, name: String, hobby: Tuple[name: String]).with_keys([:id])
      }

      subject{ op.keys }

      context 'when the order relation does not contain a key' do
        let(:op){ 
          a_lispy.rank(operand, [[:name, :asc]], :rank)
        }
        let(:expected){
          Keys[ [:id] ]
        }

        it { should eq(expected) }
      end

      context 'when the order relation does contain a key' do
        let(:op){ 
          a_lispy.rank(operand, [[[:hobby, :name], :asc], [:id, :desc]], :rank)
        }
        let(:expected){
          Keys[ [:id], [:rank] ]
        }

        it { should eq(expected) }
      end

    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
alf-core-0.15.0 spec/unit/alf-algebra/operator/rank/test_keys.rb
alf-core-0.14.0 spec/unit/alf-algebra/operator/rank/test_keys.rb