Sha256: 579958b10b95af2d617e25c7cc033e2188a3dcec140b2ffa751d8041b4792a3e
Contents?: true
Size: 1.43 KB
Versions: 1
Compression:
Stored size: 1.43 KB
Contents
# encoding: utf-8 require 'spec_helper' describe Optimizer::Algebra::Summarization::EmptyOperand, '#optimize' do subject { object.optimize } let(:header) { Relation::Header.new([ [ :id, Integer ] ]) } let(:base) { Relation.new(header, [ [ 1 ] ].each) } let(:attribute) { Attribute::Object.new(:test) } let(:operand) { base.restrict { false } } let(:summarize_per) { TABLE_DEE } let(:object) { described_class.new(relation) } context 'when the function has a default' do let(:relation) { operand.summarize(summarize_per) { |r| r.add(attribute, r[:id].count) } } before do object.should be_optimizable end it { should be_kind_of(Algebra::Extension) } it { should_not equal(operand) } its(:operand) { should equal(summarize_per) } its(:extensions) { should == { attribute => 0 } } end context 'when the function does not have a default' do let(:function) { lambda { |acc, tuple| 1 } } let(:relation) { operand.summarize(summarize_per) { |r| r.add(attribute, function) } } before do object.should be_optimizable end it { should be_kind_of(Algebra::Extension) } it { should_not equal(operand) } its(:operand) { should equal(summarize_per) } its(:extensions) { should == { attribute => nil } } end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
veritas-optimizer-0.0.4 | spec/unit/veritas/optimizer/algebra/summarization/empty_operand/optimize_spec.rb |