Sha256: dfbedfbd3277093ae6a12f7273ccb3149a57fb8dc5244ab8cab4f53f89a05fb4
Contents?: true
Size: 1.1 KB
Versions: 45
Compression:
Stored size: 1.1 KB
Contents
#!/usr/bin/env rspec require 'spec_helper' module MCollective describe RunnerStats do before do Agents.stubs(:agentlist).returns("agents") Time.stubs(:now).returns(Time.at(0)) @stats = RunnerStats.new logger = mock logger.stubs(:log) logger.stubs(:start) Log.configure(logger) end describe "#to_hash" do it "should return the correct data" do @stats.to_hash.keys.sort.should == [:stats, :threads, :pid, :times, :agents].sort @stats.to_hash[:stats].should == {:validated => 0, :unvalidated => 0, :passed => 0, :filtered => 0, :starttime => 0, :total => 0, :ttlexpired => 0, :replies => 0} @stats.to_hash[:agents].should == "agents" end end [[:ttlexpired, :ttlexpired], [:passed, :passed], [:filtered, :filtered], [:validated, :validated], [:received, :total], [:sent, :replies]].each do |tst| describe "##{tst.first}" do it "should increment #{tst.first}" do @stats.send(tst.first) @stats.to_hash[:stats][tst.last].should == 1 end end end end end
Version data entries
45 entries across 45 versions & 1 rubygems