Sha256: f2a3c1d186a6c06cffba96fc636ebbe1b3f573517f502e8668e7735bcacf2899

Contents?: true

Size: 842 Bytes

Versions: 1

Compression:

Stored size: 842 Bytes

Contents

# encoding: utf-8

require 'spec_helper'

describe Optimizer::Algebra::Join::DisjointHeaders, '#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 disjoint' do
    let(:left)  { Relation.new([ [ :id,       Integer ] ], [ [ 1 ] ].each) }
    let(:right) { Relation.new([ [ :other_id, Integer ] ], [ [ 1 ] ].each) }

    it { should be(true) }
  end

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

    it { should be(false) }
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
veritas-optimizer-0.0.7 spec/unit/veritas/optimizer/algebra/join/disjoint_headers/optimizable_spec.rb