Sha256: 9a88ae23f9a2aa4a2d16539030ce46097dac5cd9c3b5c387c6e32fc257a1a807
Contents?: true
Size: 1.37 KB
Versions: 2
Compression:
Stored size: 1.37 KB
Contents
require "spec_helper" describe Redistat::Label do include Redistat::Database before(:each) do db.flushdb @name = "about_us" @label = Redistat::Label.new(@name) end it "should initialize properly and SHA1 hash the label name" do @label.name.should == @name @label.hash.should == Digest::SHA1.hexdigest(@name) end it "should store a label hash lookup key" do label = Redistat::Label.new(@name, {:hashed_label => true}).save label.saved?.should be_true db.get("#{Redistat::KEY_LEBELS}#{label.hash}").should == @name name = "contact_us" 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
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
redistat-0.1.1 | spec/label_spec.rb |
redistat-0.1.0 | spec/label_spec.rb |