diff --git a/spec/key_spec.rb b/spec/key_spec.rb index eac99c5..95b8609 100644 --- a/spec/key_spec.rb +++ b/spec/key_spec.rb @@ -28,6 +28,8 @@ describe Redistat::Key do @key.to_s(props.last).should == "#{@scope}/#{@label}:#{@key.date.to_s(props.last)}" props.pop end + key = Redistat::Key.new(@scope, nil, @date, {:depth => :hour}) + key.to_s.should == "#{@scope}:#{key.date.to_s(:hour)}" end it "should abide to hashed_label option" do diff --git a/spec/summary_spec.rb b/spec/summary_spec.rb index 8170f44..ebf33af 100644 --- a/spec/summary_spec.rb +++ b/spec/summary_spec.rb @@ -46,6 +46,15 @@ describe Redistat::Summary do end end + it "should update summaries even if no label is set" do + key = Redistat::Key.new(@scope, nil, @date, {:depth => :day}) + Redistat::Summary.update(key, @stats, :hour) + summary = db.hgetall(key.to_s(:hour)) + summary.should have(2).items + summary["views"].should == "3" + summary["visitors"].should == "2" + end + it "should inject stats key grouping summaries" do hash = { "count/hello" => 3, "count/world" => 7, "death/bomb" => 4, "death/unicorn" => 3,