Sha256: b4b400bbfc93e054a1cfc85435d434d1292074ba96ad5b2b00457174cb03ed60

Contents?: true

Size: 991 Bytes

Versions: 15

Compression:

Stored size: 991 Bytes

Contents

#!/usr/bin/env rspec

require 'spec_helper'
require File.dirname(__FILE__) + "/../../../../../plugins/mcollective/aggregate/sum.rb"

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

15 entries across 15 versions & 1 rubygems

Version Path
mcollective-client-2.7.0 spec/unit/plugins/mcollective/aggregate/sum_spec.rb
mcollective-client-2.6.1 spec/unit/plugins/mcollective/aggregate/sum_spec.rb
mcollective-client-2.6.0 spec/unit/plugins/mcollective/aggregate/sum_spec.rb
mcollective-client-2.5.3 spec/unit/plugins/mcollective/aggregate/sum_spec.rb
mcollective-client-2.5.2 spec/unit/plugins/mcollective/aggregate/sum_spec.rb
mcollective-client-2.5.1 spec/unit/plugins/mcollective/aggregate/sum_spec.rb
mcollective-client-2.5.0 spec/unit/plugins/mcollective/aggregate/sum_spec.rb
mcollective-client-2.5.0.rc1 spec/unit/plugins/mcollective/aggregate/sum_spec.rb
mcollective-client-2.4.1 spec/unit/plugins/mcollective/aggregate/sum_spec.rb
mcollective-client-2.4.0 spec/unit/plugins/mcollective/aggregate/sum_spec.rb
mcollective-client-2.2.4 spec/unit/plugins/mcollective/aggregate/sum_spec.rb
mcollective-client-2.2.3 spec/unit/plugins/mcollective/aggregate/sum_spec.rb
mcollective-client-2.2.2 spec/unit/plugins/mcollective/aggregate/sum_spec.rb
mcollective-client-2.2.1 spec/unit/plugins/mcollective/aggregate/sum_spec.rb
mcollective-client-2.2.0 spec/unit/plugins/mcollective/aggregate/sum_spec.rb