Sha256: 4108c7439908bc606cad1fc71d34599f4f1de5923ad2be2807af7e4f949554da

Contents?: true

Size: 930 Bytes

Versions: 2

Compression:

Stored size: 930 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
    expect(object.operation).to be_kind_of(Algebra::Join)
  end

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

    it { should be(true) }
  end

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

    it { should be(false) }
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
axiom-optimizer-0.2.0 spec/unit/axiom/optimizer/algebra/join/equal_headers/optimizable_predicate_spec.rb
axiom-optimizer-0.1.1 spec/unit/axiom/optimizer/algebra/join/equal_headers/optimizable_predicate_spec.rb