updated Redistat::Key spec

This commit is contained in:
2010-07-19 12:31:04 +03:00
parent 9403aacd96
commit cfbbb7d83a

View File

@@ -4,7 +4,7 @@ describe Redistat::Key do
before(:each) do before(:each) do
@scope = "PageViews" @scope = "PageViews"
@label = "/about/us" @label = "about_us"
@label_hash = Digest::SHA1.hexdigest(@label) @label_hash = Digest::SHA1.hexdigest(@label)
@now = Time.now @now = Time.now
@key = Redistat::Key.new(@scope, @label, @now, {:depth => :day}) @key = Redistat::Key.new(@scope, @label, @now, {:depth => :day})
@@ -29,7 +29,9 @@ describe Redistat::Key do
end end
it "should abide to hash_label option" do it "should abide to hash_label option" do
@label = "about_us" @key = Redistat::Key.new(@scope, @label, @now, {:depth => :day, :hash_label => true})
@key.to_s.should == "#{@scope}/#{@label_hash}:#{@key.date.to_s(:day)}"
@key = Redistat::Key.new(@scope, @label, @now, {:depth => :day, :hash_label => false}) @key = Redistat::Key.new(@scope, @label, @now, {:depth => :day, :hash_label => false})
@key.to_s.should == "#{@scope}/#{@label}:#{@key.date.to_s(:day)}" @key.to_s.should == "#{@scope}/#{@label}:#{@key.date.to_s(:day)}"
end end