Sha256: 171120b8d2bd7fe7f8534b813a158326f09c89be403a89266e4fee232df878a4
Contents?: true
Size: 805 Bytes
Versions: 1
Compression:
Stored size: 805 Bytes
Contents
# encoding: utf-8 require 'spec_helper' describe Aggregate::Mean, '.call' do subject do values.reduce(default) do |accumulator, value| object.call(accumulator, value) end end let(:default) { object.default } let(:object) { described_class } context 'when the value is 0' do let(:values) { [ 0 ] } it 'returns the expected count and mean of the values' do should eql([ 1, 0.0 ]) end end context 'when the values are not nil' do let(:values) { [ -6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6 ] } it 'returns the expected count and mean of the values' do should eql([ 13, 0.0 ]) end end context 'when the values are nil' do let(:values) { [ nil ] } it 'returns the default' do should equal(default) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
axiom-0.1.0 | spec/unit/axiom/aggregate/mean/class_methods/call_spec.rb |