Sha256: 879575c6e3f604c5abefe19253d5494594991a36d397d833488e8cfe4a7f3848

Contents?: true

Size: 903 Bytes

Versions: 4

Compression:

Stored size: 903 Bytes

Contents

# encoding: utf-8

require 'spec_helper'

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

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

4 entries across 4 versions & 1 rubygems

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