Sha256: 7a0185d671624c3b5134119013091ec15a1895a461e9ba42e5c6e7b275e5d6ea

Contents?: true

Size: 878 Bytes

Versions: 2

Compression:

Stored size: 878 Bytes

Contents

# encoding: utf-8

require 'spec_helper'

describe Optimizer::Algebra::Projection::ProjectionOperand, '#optimizable?' do
  subject { object.optimizable? }

  let(:header)   { Relation::Header.coerce([[:id, Integer], [:name, String], [:age, Integer]]) }
  let(:base)     { Relation.new(header, LazyEnumerable.new([[1, 'Dan Kubb', 35]]))             }
  let(:relation) { operand.project([:id])                                                      }
  let(:object)   { described_class.new(relation)                                               }

  before do
    expect(object.operation).to be_kind_of(Algebra::Projection)
  end

  context 'when the operand is a projection' do
    let(:operand) { base.project([:id, :name]) }

    it { should be(true) }
  end

  context 'when the operand is not a projection' do
    let(:operand) { base }

    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/projection/projection_operand/optimizable_predicate_spec.rb
axiom-optimizer-0.1.1 spec/unit/axiom/optimizer/algebra/projection/projection_operand/optimizable_predicate_spec.rb