Sha256: 83fd3a2e749c9752fd5627b2df5aac05787b7ecab75d61880850608d2bffd943

Contents?: true

Size: 1008 Bytes

Versions: 1

Compression:

Stored size: 1008 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.5 spec/unit/veritas/optimizer/algebra/summarization/empty_summarize_per/optimize_spec.rb