Sha256: 594fbe35bed448663869987a22d63165f077b7efa58e926ff1f1197727626edf

Contents?: true

Size: 925 Bytes

Versions: 1

Compression:

Stored size: 925 Bytes

Contents

require 'spec_helper'

describe 'Veritas::Algebra::Summarization::Methods#summarize' do
  subject { object.summarize(summarize_by, &block) }

  let(:klass)       { Relation                                        }
  let(:summarizers) { [ :test, lambda { |acc, tuple| 1 } ]            }
  let(:block)       { lambda { |r| r.add(*summarizers) }              }
  let(:object)      { klass.new([ [ :id, Integer ] ], [ [ 1 ] ].each) }

  context 'when summarizing by a relation' do
    let(:summarize_by) { object }

    it { should be_kind_of(Algebra::Summarization) }

    its(:operand) { should equal(object) }

    its(:summarize_by) { should equal(summarize_by) }
  end

  context 'when summarizing by a header' do
    let(:summarize_by) { [ :id ] }

    it { should be_kind_of(Algebra::Summarization) }

    its(:operand) { should equal(object) }

    its(:summarize_by) { should == object.project(summarize_by) }
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
veritas-0.0.2 spec/unit/veritas/algebra/summarization/methods/summarize_spec.rb