Sha256: 71d26f7d3da3a7050bd20d7b1d51f7290d04576f680222cf5994a5b6f5162811

Contents?: true

Size: 760 Bytes

Versions: 4

Compression:

Stored size: 760 Bytes

Contents

# encoding: utf-8

require 'spec_helper'

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

  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)  { left.union(right).restrict { predicate }   }
  let(:object)    { described_class.new(relation)              }

  before do
    object.should be_optimizable
  end

  it { should be_kind_of(Relation::Operation::Set) }

  its(:left) { should eql(left.restrict { predicate }) }

  its(:right) { should eql(right.restrict { predicate }) }
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/optimize_spec.rb
veritas-optimizer-0.0.6 spec/unit/veritas/optimizer/algebra/restriction/set_operand/optimize_spec.rb
veritas-optimizer-0.0.5 spec/unit/veritas/optimizer/algebra/restriction/set_operand/optimize_spec.rb
veritas-optimizer-0.0.4 spec/unit/veritas/optimizer/algebra/restriction/set_operand/optimize_spec.rb