Sha256: 7ce7c7e7fcdf6626ffc9d28694da1c7ff8395c6c46d3f03f3bb4f47082bdcd72

Contents?: true

Size: 904 Bytes

Versions: 2

Compression:

Stored size: 904 Bytes

Contents

# encoding: utf-8

require 'spec_helper'

describe Optimizer::Algebra::Summarization::EmptyOperand, '#optimizable?' do
  subject { object.optimizable? }

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

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

  context 'when the operand is empty' do
    let(:operand) { base.restrict { false } }

    it { should be(true) }
  end

  context 'when the operand is not empty' 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/summarization/empty_operand/optimizable_predicate_spec.rb
axiom-optimizer-0.1.1 spec/unit/axiom/optimizer/algebra/summarization/empty_operand/optimizable_predicate_spec.rb