lots of changes and cleanup, among others created

a Redistat::Scope object
This commit is contained in:
2010-07-23 21:46:14 +03:00
parent 22515337f6
commit 9c9b784a8a
8 changed files with 106 additions and 41 deletions

30
spec/scope_spec.rb Normal file
View File

@@ -0,0 +1,30 @@
require "spec_helper"
describe Redistat::Scope do
before(:all) do
db.flushdb
end
before(:each) do
@name = "PageViews"
@scope = Redistat::Scope.new(@name)
end
it "should initialize properly" do
@scope.to_s.should == @name
end
it "should increment next_id" do
scope = Redistat::Scope.new("Visitors")
@scope.next_id.should == 1
scope.next_id.should == 1
@scope.next_id.should == 2
scope.next_id.should == 2
end
def db
Redistat.redis
end
end