Sha256: 947871344c8aab6db092dff9044f8a773f05f2f7f47cfb02238cc848cf86bab2

Contents?: true

Size: 774 Bytes

Versions: 1

Compression:

Stored size: 774 Bytes

Contents

# encoding: utf-8

require 'spec_helper'

describe Algebra::Summarization::Summary, '#summarize_by' do
  subject { object.summarize_by(projection, tuple) }

  let(:object)     { described_class.new(summarizer)                       }
  let(:summarizer) { lambda { |accumulator, tuple| accumulator.to_i.succ } }
  let(:header)     { Relation::Header.coerce([ [ :id, Integer ] ])         }
  let(:tuple)      { Tuple.new(header, [ 1 ])                              }
  let(:projection) { tuple.project([])                                     }

  it_should_behave_like 'a command method'

  it 'aggregates the value returned by the summarizer' do
    2.times { subject; __memoized.delete(:subject) }  # bypass subject cache
    object.call(projection).should eql(2)
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
axiom-0.1.0 spec/unit/axiom/algebra/summarization/summary/summarize_by_spec.rb