diff --git a/spec/_redistat_spec.rb b/spec/_redistat_spec.rb index ce63f68..7d1630b 100644 --- a/spec/_redistat_spec.rb +++ b/spec/_redistat_spec.rb @@ -2,9 +2,23 @@ require "spec_helper" describe Redistat do - it "should create a valid redis connection to correct server" do - Redistat.redis.should_not be_nil - Redistat.redis.client.port.should == 8379 + it "should have a valid redis client instance" do + redis.should_not be_nil + end + + it "should be connected to the testing server" do + redis.client.port.should == 8379 + redis.client.host.should == "127.0.0.1" + end + + it "should be able to set and get data" do + redis.set "hello", "world" + redis.get("hello").should == "world" + redis.del("hello").should be_true + end + + def redis + Redistat.redis end end \ No newline at end of file diff --git a/spec/label_spec.rb b/spec/label_spec.rb index 3f520a2..b1b68e0 100644 --- a/spec/label_spec.rb +++ b/spec/label_spec.rb @@ -9,4 +9,21 @@ describe Redistat::Label do 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 \ No newline at end of file