Sha256: 0a455ebe18d4ba4a7fdc60300f9716ccc8d04881bc5a87ec7a3d90d19eaba41f

Contents?: true

Size: 939 Bytes

Versions: 28

Compression:

Stored size: 939 Bytes

Contents

#!/usr/bin/env rspec

require 'spec_helper'
require 'mcollective/aggregate/sum'

module MCollective
  class Aggregate
    describe Sum do
      describe "#startup_hook" do
        it "should set the correct result hash" do
          result = Sum.new(:test, [], "%d", :test_action)
          result.result.should == {:value => 0, :type => :numeric, :output => :test}
          result.aggregate_format.should == "%d"
        end

        it "should set a defauly aggregate_format if one isn't defined" do
          result = Sum.new(:test, [], nil, :test_action)
          result.aggregate_format.should == "Sum of test: %f"
        end
      end

      describe "#process_result" do
        it "should add the reply value to the result hash" do
          average = Sum.new([:test], [], "%d", :test_action)
          average.process_result(1, {:test => 1})
          average.result[:value].should == 1
        end
      end
    end
  end
end

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
mcollective-client-2.12.5 spec/unit/mcollective/aggregate/sum_spec.rb
mcollective-client-2.12.4 spec/unit/mcollective/aggregate/sum_spec.rb
mcollective-client-2.12.3 spec/unit/mcollective/aggregate/sum_spec.rb
mcollective-client-2.12.1 spec/unit/mcollective/aggregate/sum_spec.rb
mcollective-client-2.12.0 spec/unit/mcollective/aggregate/sum_spec.rb
mcollective-client-2.10.6 spec/unit/mcollective/aggregate/sum_spec.rb
mcollective-client-2.11.4 spec/unit/mcollective/aggregate/sum_spec.rb
mcollective-client-2.11.3 spec/unit/mcollective/aggregate/sum_spec.rb
mcollective-client-2.11.2 spec/unit/mcollective/aggregate/sum_spec.rb
mcollective-client-2.11.1 spec/unit/mcollective/aggregate/sum_spec.rb
mcollective-client-2.11.0 spec/unit/mcollective/aggregate/sum_spec.rb
mcollective-client-2.10.4 spec/unit/mcollective/aggregate/sum_spec.rb
mcollective-client-2.10.3 spec/unit/mcollective/aggregate/sum_spec.rb
mcollective-client-2.10.2 spec/unit/mcollective/aggregate/sum_spec.rb
mcollective-client-2.10.1 spec/unit/mcollective/aggregate/sum_spec.rb
mcollective-client-2.10.0 spec/unit/mcollective/aggregate/sum_spec.rb
mcollective-client-2.8.7 spec/unit/mcollective/aggregate/sum_spec.rb
mcollective-client-2.8.5 spec/unit/mcollective/aggregate/sum_spec.rb
mcollective-client-2.8.8 spec/unit/mcollective/aggregate/sum_spec.rb
mcollective-client-2.8.6 spec/unit/mcollective/aggregate/sum_spec.rb