Sha256: 5e72d8c89a0fd7cdd50d288b332cd1dfd1f65449a3c181d358fd37d781d0652b

Contents?: true

Size: 590 Bytes

Versions: 9

Compression:

Stored size: 590 Bytes

Contents

require 'spec_helper'
module Alf
  class Aggregator
    describe Stddev do

      let(:rel){[
        {:qty => 10}, 
        {:qty => 20},
        {:qty => 30},
        {:qty => 40}
      ]}
      let(:expected) {
        Math.sqrt(Variance.new{qty}.aggregate(rel))
      }

      it 'should work when used standalone' do
        Stddev.new{ qty }.aggregate(rel).should eq(expected)
      end

      it 'should install factory methods' do
        Aggregator.stddev{ qty }.should be_a(Stddev)
        Aggregator.stddev{ qty }.aggregate(rel).should eq(expected)
      end

    end
  end
end 

Version data entries

9 entries across 9 versions & 2 rubygems

Version Path
alf-core-0.15.0 spec/unit/alf-aggregator/test_stddev.rb
alf-core-0.14.0 spec/unit/alf-aggregator/test_stddev.rb
alf-core-0.13.1 spec/unit/alf-aggregator/test_stddev.rb
alf-core-0.13.0 spec/unit/alf-aggregator/test_stddev.rb
alf-0.12.2 spec/unit/alf-core/aggregator/test_stddev.rb
alf-0.12.1 spec/unit/alf-core/aggregator/test_stddev.rb
alf-0.12.0 spec/unit/alf-core/aggregator/test_stddev.rb
alf-0.11.1 spec/unit/alf-core/aggregator/test_stddev.rb
alf-0.11.0 spec/unit/alf-core/aggregator/test_stddev.rb