Sha256: 171bfc31b23845f910c6694c25ad9cfcab042506ce25f23c8719209970695f6f

Contents?: true

Size: 682 Bytes

Versions: 1

Compression:

Stored size: 682 Bytes

Contents

require 'spec_helper'

describe 'Veritas::Algebra::Summarization#each' do
  subject { object.each { |tuple| yields << tuple } }

  let(:klass)       { Algebra::Summarization                               }
  let(:operand)     { Relation.new([ [ :id, Integer ] ], [ [ 1 ], [ 2 ] ]) }
  let(:summarizers) { { :count => lambda { |acc, tuple| acc.to_i + 1 } }   }
  let(:object)      { klass.new(operand, operand.project([]), summarizers) }
  let(:yields)      { []                                                   }

  it_should_behave_like 'a command method'

  it 'yields each tuple' do
    expect { subject }.to change { yields.dup }.
      from([]).
      to([ [ 2 ] ])
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

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