Sha256: b0641fe1263c6e731c08cf04d2d4747a44cb6eb579330b65256c359b16862328

Contents?: true

Size: 1003 Bytes

Versions: 4

Compression:

Stored size: 1003 Bytes

Contents

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

      let(:operand){
        an_operand.with_heading(:id => Integer, :name => String, :status => String).
                   with_keys([:id], [:name])
      }

      subject{ op.keys }

      context 'when conserving at least one key' do
        let(:op){ 
          a_lispy.clip(operand, [:id, :status])
        }
        let(:expected){
          Keys[ [:id] ]
        }

        it { should eq(expected) }
      end

      context 'when conserving at least one key (--allbut)' do
        let(:op){ 
          a_lispy.clip(operand, [:name], :allbut => true)
        }
        let(:expected){
          Keys[ [:id] ]
        }

        it { should eq(expected) }
      end

      context 'when projecting all keys away' do
        let(:op){ 
          a_lispy.clip(operand, [:status])
        }
        let(:expected){
          Keys[ [:status] ]
        }

        it { should eq(expected) }
      end

    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
alf-core-0.15.0 spec/unit/alf-algebra/operator/clip/test_keys.rb
alf-core-0.14.0 spec/unit/alf-algebra/operator/clip/test_keys.rb
alf-core-0.13.1 spec/unit/alf-algebra/operator/clip/test_keys.rb
alf-core-0.13.0 spec/unit/alf-algebra/operator/clip/test_keys.rb