Sha256: 8a93774e83807a39cdd7ef5ebf173ab459c02611e279df7544180a2864b41566

Contents?: true

Size: 1.03 KB

Versions: 5

Compression:

Stored size: 1.03 KB

Contents

# encoding: utf-8

require 'spec_helper'

describe Optimizer::Algebra::Summarization, '#summarizers' do
  subject { object.summarizers }

  let(:base)          { Relation.new([ [ :id, Integer ] ], [ [ 1 ] ])                    }
  let(:attribute)     { Attribute::Object.new(:test)                                     }
  let(:summarize_per) { TABLE_DEE                                                        }
  let(:relation)      { base.summarize(summarize_per) { |r| r.add(attribute, function) } }
  let(:object)        { described_class.new(relation)                                    }

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

  context 'when summarizers are optimized' do
    let(:function) { base[:id].sum }

    it { should eql(relation.summarizers) }
  end

  context 'when summarizers are not optimized' do
    let(:function) { Aggregate::Sum.new(Function::Numeric::Absolute.new(1)) }

    it { should_not equal(relation.summarizers) }

    it { should eql(attribute => Aggregate::Sum.new(1)) }
  end
end

Version data entries

5 entries across 5 versions & 2 rubygems

Version Path
axiom-optimizer-0.1.0 spec/unit/axiom/optimizer/algebra/summarization/summarizers_spec.rb
veritas-optimizer-0.0.7 spec/unit/veritas/optimizer/algebra/summarization/summarizers_spec.rb
veritas-optimizer-0.0.6 spec/unit/veritas/optimizer/algebra/summarization/summarizers_spec.rb
veritas-optimizer-0.0.5 spec/unit/veritas/optimizer/algebra/summarization/summarizers_spec.rb
veritas-optimizer-0.0.4 spec/unit/veritas/optimizer/algebra/summarization/summarizers_spec.rb