Sha256: 823864bf96acbd9b36a2b531c9f500293c63c4379cb1a3ae5fcb61fdcb5b4105

Contents?: true

Size: 868 Bytes

Versions: 4

Compression:

Stored size: 868 Bytes

Contents

# encoding: utf-8

require 'spec_helper'

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

  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)    { described_class.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

4 entries across 4 versions & 1 rubygems

Version Path
veritas-optimizer-0.0.7 spec/unit/veritas/optimizer/algebra/restriction/set_operand/optimizable_spec.rb
veritas-optimizer-0.0.6 spec/unit/veritas/optimizer/algebra/restriction/set_operand/optimizable_spec.rb
veritas-optimizer-0.0.5 spec/unit/veritas/optimizer/algebra/restriction/set_operand/optimizable_spec.rb
veritas-optimizer-0.0.4 spec/unit/veritas/optimizer/algebra/restriction/set_operand/optimizable_spec.rb