Sha256: 04cf8885e01c728d5bdf900ea05e2933de83a9888e72dbf5c5fb77c90b103883

Contents?: true

Size: 1022 Bytes

Versions: 1

Compression:

Stored size: 1022 Bytes

Contents

# encoding: utf-8

require 'spec_helper'

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

  let(:header)        { Relation::Header.new([ [ :id, Integer ], [ :name, String ] ])             }
  let(:base)          { Relation.new(header, [ [ 1, 'Dan Kubb' ] ].each)                          }
  let(:attribute)     { Attribute::Object.new(:test)                                              }
  let(:operand)       { base                                                                      }
  let(:summarize_per) { base.project([ :id ]).restrict { false }                                  }
  let(:relation)      { operand.summarize(summarize_per) { |r| r.add(attribute, r[:name].count) } }
  let(:object)        { described_class.new(relation)                                             }

  before do
    object.should be_optimizable
  end

  it { should be_kind_of(Relation::Empty) }

  its(:header) { should == [ [ :id, Integer ], [ :test, Object ] ] }
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_summarize_per/optimize_spec.rb