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

- old
+ new

@@ -23,6 +23,26 @@ label = Redistat::Label.create(name, {:hashed_label => true}) label.saved?.should be_true db.get("#{Redistat::KEY_LEBELS}#{label.hash}").should == name end + it "should separate label names into groups" do + name = "message/public/offensive" + label = Redistat::Label.new(name) + label.name.should == name + label.groups.should == [ "message/public/offensive", + "message/public", + "message" ] + + name = "/message/public/" + label = Redistat::Label.new(name) + label.name.should == name + label.groups.should == [ "message/public", + "message" ] + + name = "message" + label = Redistat::Label.new(name) + label.name.should == name + label.groups.should == [ "message" ] + end + end \ No newline at end of file