Sha256: a5857679bc95e7bcbd2f79a11bbe07a054e97d0a2a434cafaec4f5fb1e7ca8d0

Contents?: true

Size: 581 Bytes

Versions: 2

Compression:

Stored size: 581 Bytes

Contents

# encoding: utf-8

require 'spec_helper'

describe Aggregate::Count, '.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 values are not nil' do
    let(:values) { [1, 2, 3, 4, 5, 6] }

    it 'returns the expected count the values' do
      should eql(6)
    end
  end

  context 'when the values are nil' do
    let(:values) { [nil] }

    it 'returns the default' do
      should be(default)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
axiom-0.2.0 spec/unit/axiom/aggregate/count/class_methods/call_spec.rb
axiom-0.1.1 spec/unit/axiom/aggregate/count/class_methods/call_spec.rb