mirror of
https://github.com/jimeh/redistat.git
synced 2026-02-19 13:26:39 +00:00
29 lines
699 B
Ruby
29 lines
699 B
Ruby
require "spec_helper"
|
|
|
|
describe Redistat::Label do
|
|
|
|
it "should initialize and SHA1 hash the label name" do
|
|
name = "/about/us"
|
|
label = Redistat::Label.new(name)
|
|
label.name.should == name
|
|
label.hash.should == Digest::SHA1.hexdigest(name)
|
|
end
|
|
|
|
it "should store a label hash lookup key" do
|
|
name = "/about/us"
|
|
label = Redistat::Label.new(name)
|
|
label.save
|
|
label.saved?.should be_true
|
|
redis.get("Redistat:lables:#{label.hash}").should == name
|
|
|
|
name = "/contact/us"
|
|
label = Redistat::Label.create(name)
|
|
label.saved?.should be_true
|
|
redis.get("Redistat:lables:#{label.hash}").should == name
|
|
end
|
|
|
|
def redis
|
|
Redistat.redis
|
|
end
|
|
|
|
end |