added class_name option to Model warpper for

customizing the scope used in Redis keys
This commit is contained in:
2010-12-29 17:26:22 +00:00
parent 0597b587fd
commit 115b223d7c
3 changed files with 22 additions and 1 deletions

View File

@@ -20,4 +20,11 @@ class ModelHelper3
connect_to :port => 8379, :db => 14
end
class ModelHelper4
include Redistat::Model
class_name "FancyHelper"
end

View File

@@ -8,6 +8,7 @@ describe Redistat::Model do
ModelHelper1.redis.flushdb
ModelHelper2.redis.flushdb
ModelHelper3.redis.flushdb
ModelHelper4.redis.flushdb
end
it "should should name itself correctly" do
@@ -19,6 +20,7 @@ describe Redistat::Model do
ModelHelper2.depth.should == :day
ModelHelper2.store_event.should == true
ModelHelper2.hashed_label.should == true
ModelHelper2.class_name.should be_nil
ModelHelper1.depth.should == nil
ModelHelper1.store_event.should == nil
@@ -35,6 +37,9 @@ describe Redistat::Model do
ModelHelper1.depth.should == nil
ModelHelper1.store_event.should == nil
ModelHelper1.hashed_label.should == nil
ModelHelper4.class_name.should == "FancyHelper"
ModelHelper4.send(:name).should == "FancyHelper"
end
it "should store and fetch stats" do