Sha256: a3371cb944473774ab310d76bc27a84493958870bd2b8c00fa9aef35cd428324

Contents?: true

Size: 1017 Bytes

Versions: 2

Compression:

Stored size: 1017 Bytes

Contents

require 'spec_helper'

describe 'Veritas::Optimizer::Algebra::Restriction::RestrictionOperand#optimizable?' do
  subject { object.optimizable? }

  let(:klass)     { Optimizer::Algebra::Restriction::RestrictionOperand }
  let(:header)    { Relation::Header.new([ [ :id, Integer ] ])          }
  let(:base)      { Relation.new(header, [ [ 1 ] ].each)                }
  let(:predicate) { header[:id].eq(1)                                   }
  let(:relation)  { operand.restrict(predicate)                         }
  let(:object)    { klass.new(relation)                                 }

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

  context 'when the operand is an restriction operation' do
    let(:other_predicate) { header[:id].include([ 1 ])     }
    let(:operand)         { base.restrict(other_predicate) }

    it { should be(true) }
  end

  context 'when the operand is not a restriction operation' 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/restriction/restriction_operand/optimizable_spec.rb
veritas-0.0.1 spec/unit/veritas/optimizer/algebra/restriction/restriction_operand/optimizable_spec.rb