Sha256: 96a01c99b2972c51b675fab15146cadc93c985d5722f6630f46d1938a5025c8b

Contents?: true

Size: 948 Bytes

Versions: 4

Compression:

Stored size: 948 Bytes

Contents

# encoding: utf-8

require 'spec_helper'

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

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

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

  context 'when the summarize_per is empty' do
    let(:summarize_per) { base.project([ :id ]).restrict { false } }

    it { should be(true) }
  end

  context 'when the summarize_per is not empty' do
    let(:summarize_per) { base.project([ :id ]) }

    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/summarization/empty_summarize_per/optimizable_spec.rb
veritas-optimizer-0.0.6 spec/unit/veritas/optimizer/algebra/summarization/empty_summarize_per/optimizable_spec.rb
veritas-optimizer-0.0.5 spec/unit/veritas/optimizer/algebra/summarization/empty_summarize_per/optimizable_spec.rb
veritas-optimizer-0.0.4 spec/unit/veritas/optimizer/algebra/summarization/empty_summarize_per/optimizable_spec.rb