Sha256: 23c6cdc2f8398b7e65377e201bcaa3f688613fccaa1169ab146e08c2866ae7db

Contents?: true

Size: 969 Bytes

Versions: 2

Compression:

Stored size: 969 Bytes

Contents

require 'spec_helper'

describe 'Veritas::Optimizer::Algebra::Join::EqualHeaders#optimizable?' do
  subject { object.optimizable? }

  let(:klass)    { Optimizer::Algebra::Join::EqualHeaders }
  let(:relation) { left.join(right)                       }
  let(:object)   { klass.new(relation)                    }

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

  context 'when left and right headers are equal' do
    let(:header) { Relation::Header.new([ [ :id, Integer ] ]) }
    let(:left)   { Relation.new(header, [ [ 1 ] ].each)       }
    let(:right)  { Relation.new(header, [ [ 1 ] ].each)       }

    it { should be(true) }
  end

  context 'when left and right headers are not equal' do
    let(:left)  { Relation.new([ [ :id, Integer ] ], [ [ 1 ] ].each)                                 }
    let(:right) { Relation.new([ [ :id, Integer ], [ :name, String  ] ], [ [ 1, 'Dan Kubb' ] ].each) }

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