spec/key_spec.rb in redistat-0.0.9 vs spec/key_spec.rb in redistat-0.1.0

- old
+ new

@@ -12,10 +12,11 @@ it "should initialize properly" do @key.scope.should == @scope @key.label.should == @label @key.label_hash.should == @label_hash + @key.label_groups.should == @key.instance_variable_get("@label").groups @key.date.should be_instance_of(Redistat::Date) @key.date.to_time.to_s.should == @date.to_s end it "should convert to string properly" do @@ -56,8 +57,20 @@ @label = "contact_us" @label_hash = Digest::SHA1.hexdigest(@label) @key.label = @label @key.label.should == @label @key.label_hash == @label_hash + end + + it "should create a group of keys from label group" do + label = 'message/public/offensive' + result = [ "message/public/offensive", + "message/public", + "message" ] + + key = Redistat::Key.new(@scope, label, @date, {:depth => :hour}) + + key.label_groups.should == result + key.groups.map { |k| k.label }.should == result end end \ No newline at end of file