6 describe RunnerStats do
8 Agents.stubs(:agentlist).returns("agents")
9 Time.stubs(:now).returns(Time.at(0))
11 @stats = RunnerStats.new
19 describe "#to_hash" do
20 it "should return the correct data" do
21 @stats.to_hash.keys.sort.should == [:stats, :threads, :pid, :times, :agents].sort
23 @stats.to_hash[:stats].should == {:validated => 0, :unvalidated => 0, :passed => 0, :filtered => 0,
24 :starttime => 0, :total => 0, :ttlexpired => 0, :replies => 0}
26 @stats.to_hash[:agents].should == "agents"
30 [[:ttlexpired, :ttlexpired], [:passed, :passed], [:filtered, :filtered],
31 [:validated, :validated], [:received, :total], [:sent, :replies]].each do |tst|
32 describe "##{tst.first}" do
33 it "should increment #{tst.first}" do
34 @stats.send(tst.first)
35 @stats.to_hash[:stats][tst.last].should == 1