Sha256: d2043df289e539aae607ef2783d25cb00e876e338e6f2be06248bed5e89d371d

Contents?: true

Size: 767 Bytes

Versions: 1

Compression:

Stored size: 767 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) { ->(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 do
      subject
      __memoized.delete(:subject)  # bypass subject cache
    end
    object.call(projection).should eql(2)
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

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