Sha256: ac8e712d21b7db0405a1984494665c39b7e6a776cb42d589cf608e59598d9df9

Contents?: true

Size: 1.06 KB

Versions: 4

Compression:

Stored size: 1.06 KB

Contents

# encoding: utf-8

require 'spec_helper'

describe Optimizer::Algebra::Projection::UnionOperand, '#optimize' do
  subject { object.optimize }

  let(:header)     { Relation::Header.new([ [ :id, Integer ], [ :name, String ], [ :age, Integer ] ]) }
  let(:base_left)  { Relation.new(header, [ [ 1, 'Dan Kubb', 35 ] ].each)                             }
  let(:base_right) { Relation.new(header, [ [ 2, 'Dan Kubb', 35 ] ].each)                             }
  let(:left)       { base_left.rename({})                                                             }
  let(:right)      { base_right.rename({})                                                            }
  let(:relation)   { left.union(right).project([ :id ])                                               }
  let(:object)     { described_class.new(relation)                                                    }

  before do
    object.should be_optimizable
  end

  it { should be_kind_of(Algebra::Union) }

  its(:left) { should eql(base_left.project([ :id ])) }

  its(:right) { should eql(base_right.project([ :id ])) }
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
veritas-optimizer-0.0.7 spec/unit/veritas/optimizer/algebra/projection/union_operand/optimize_spec.rb
veritas-optimizer-0.0.6 spec/unit/veritas/optimizer/algebra/projection/union_operand/optimize_spec.rb
veritas-optimizer-0.0.5 spec/unit/veritas/optimizer/algebra/projection/union_operand/optimize_spec.rb
veritas-optimizer-0.0.4 spec/unit/veritas/optimizer/algebra/projection/union_operand/optimize_spec.rb