Sha256: d7c6b9c4c803c28feded0ad852d3bc75f1070b1f9f2f9dc667ef7126cf21c5de

Contents?: true

Size: 928 Bytes

Versions: 2

Compression:

Stored size: 928 Bytes

Contents

require 'spec_helper'

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

  let(:klass)     { Optimizer::Algebra::Restriction::SetOperand }
  let(:header)    { Relation::Header.new([ [ :id, Integer ] ])  }
  let(:left)      { Relation.new(header, [ [ 1 ] ].each)        }
  let(:right)     { Relation.new(header, [ [ 2 ] ].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 a set operation' do
    let(:operand) { left.union(right) }

    it { should be(true) }
  end

  context 'when the operand is not a set operation' do
    let(:operand) { left }

    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/set_operand/optimizable_spec.rb
veritas-0.0.1 spec/unit/veritas/optimizer/algebra/restriction/set_operand/optimizable_spec.rb