Sha256: 6a38d43c2074e9d6d718a1b070ef0f46257a3c4786c6b6f4f0f1af295c39f232

Contents?: true

Size: 1.11 KB

Versions: 4

Compression:

Stored size: 1.11 KB

Contents

require 'spec_helper'
module Alf
  module Algebra
    describe Wrap, 'wrap' do

      subject{ op.keys }

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

      context 'when no key is wrapped' do
        let(:op){ 
          a_lispy.wrap(operand, [:name], :names)
        }

        it{ should eq(Keys[ [:id] ]) }
      end

      context 'when no key is wrapped (--allbut)' do
        let(:op){ 
          a_lispy.wrap(operand, [:id], :names, :allbut => true)
        }

        it{ should eq(Keys[ [:id] ]) }
      end

      context 'when a key is fully wrapped' do
        let(:op){ 
          a_lispy.wrap(operand, [:id, :name], :supplier)
        }

        it{ should eq(Keys[ [:supplier] ]) }
      end

      context 'when a key is partially wrapped' do
        let(:operand){
          an_operand.with_heading(:id => Integer, :name => String, :status => Integer).with_keys([:id, :name])
        }
        let(:op){ 
          a_lispy.wrap(operand, [:name, :status], :supplier)
        }

        it{ should eq(Keys[ [:id, :supplier] ]) }
      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/wrap/test_keys.rb
alf-core-0.14.0 spec/unit/alf-algebra/operator/wrap/test_keys.rb
alf-core-0.13.1 spec/unit/alf-algebra/operator/wrap/test_keys.rb
alf-core-0.13.0 spec/unit/alf-algebra/operator/wrap/test_keys.rb