additional specs for Redistat::Buffer, still a few more needed

This commit is contained in:
2011-04-15 17:42:48 +01:00
parent 2ca5aae4b8
commit 4b06513813

View File

@@ -51,7 +51,7 @@ describe Redistat::Buffer do
@buffer.send(:reset_queue, true).should == {:hello => 'world'}
end
it "should flush data into Summary.update properly" do
it "should #flush_data into Summary.update properly" do
# the root level key value doesn't actually matter, but it's something like this...
data = {'ScopeName/label/goes/here:2011:nil:true:true' => {
:key => mock("Key"),
@@ -64,4 +64,12 @@ describe Redistat::Buffer do
@buffer.send(:flush_data, data)
end
it "should build #buffer_key correctly" do
key = mock('Key', :to_s => "Scope/label:2011")
opts = {:enable_grouping => true, :label_indexing => false, :connection_ref => nil}
@buffer.send(:buffer_key, key, opts).should == "#{key.to_s}::true:false"
opts = {:enable_grouping => false, :label_indexing => true, :connection_ref => :omg}
@buffer.send(:buffer_key, key, opts).should == "#{key.to_s}:omg:false:true"
end
end