updated some redis client object access code

This commit is contained in:
2010-07-20 02:59:37 +03:00
parent 1daf8613dd
commit ebfdfcabea
2 changed files with 10 additions and 7 deletions

View File

@@ -3,5 +3,8 @@ module Redistat
def db def db
Redistat.redis Redistat.redis
end end
def self.db
Redistat.redis
end
end end
end end

View File

@@ -3,21 +3,21 @@ require "spec_helper"
describe Redistat do describe Redistat do
it "should have a valid redis client instance" do it "should have a valid redis client instance" do
redis.should_not be_nil db.should_not be_nil
end end
it "should be connected to the testing server" do it "should be connected to the testing server" do
redis.client.port.should == 8379 db.client.port.should == 8379
redis.client.host.should == "127.0.0.1" db.client.host.should == "127.0.0.1"
end end
it "should be able to set and get data" do it "should be able to set and get data" do
redis.set "hello", "world" db.set "hello", "world"
redis.get("hello").should == "world" db.get("hello").should == "world"
redis.del("hello").should be_true db.del("hello").should be_true
end end
def redis def db
Redistat.redis Redistat.redis
end end