Sha256: cddc9315053b0c0929a87e33bf401acd374e260f12fbf274806cf063f49b2ed3

Contents?: true

Size: 986 Bytes

Versions: 2

Compression:

Stored size: 986 Bytes

Contents

require 'spec_helper'

describe 'Veritas::Optimizer::Algebra::Projection::ProjectionOperand#optimizable?' do
  subject { object.optimizable? }

  let(:klass)    { Optimizer::Algebra::Projection::ProjectionOperand                                }
  let(:header)   { Relation::Header.new([ [ :id, Integer ], [ :name, String ], [ :age, Integer ] ]) }
  let(:base)     { Relation.new(header, [ [ 1, 'Dan Kubb', 35 ] ].each)                             }
  let(:relation) { operand.project([ :id ])                                                         }
  let(:object)   { klass.new(relation)                                                              }

  before do
    object.operation.should be_kind_of(Algebra::Projection)
  end

  context 'when the operand is a projection' do
    let(:operand) { base.project([ :id, :name ]) }

    it { should be(true) }
  end

  context 'when the operand is not a projection' do
    let(:operand) { base }

    it { should be(false) }
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
veritas-0.0.2 spec/unit/veritas/optimizer/algebra/projection/projection_operand/optimizable_spec.rb
veritas-0.0.1 spec/unit/veritas/optimizer/algebra/projection/projection_operand/optimizable_spec.rb