Sha256: d986fa8a671ce8851f679308742ae30e9b82931a9353812e985c7d38d4d3ac8c

Contents?: true

Size: 663 Bytes

Versions: 5

Compression:

Stored size: 663 Bytes

Contents

require 'spec_helper'
module Alf
  module Engine
    describe Aggregate do

      it 'should work on an empty operand' do
        Autonum.new([], Summarization[{}]).to_a.should eq([])
      end

      it 'should work on a non empty operand' do
        rel = [
          {:name => "Jones", :price => 12.0, :id => 1},
          {:name => "Smith", :price => 10.0, :id => 2}
        ]
        agg = Summarization[:size  => "count", 
                            :total => "sum{ price }"]
        exp = [
          {:size => 2, :total => 22.0}
        ]
        Aggregate.new(rel, agg).to_a.should eq(exp)
      end

    end
  end # module Engine
end # module Alf    

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
alf-0.12.2 spec/unit/alf-engine/test_aggregate.rb
alf-0.12.1 spec/unit/alf-engine/test_aggregate.rb
alf-0.12.0 spec/unit/alf-engine/test_aggregate.rb
alf-0.11.1 spec/unit/alf-engine/test_aggregate.rb
alf-0.11.0 spec/unit/alf-engine/test_aggregate.rb