From 4b06513813c3a5389752aabbbcd3e9c3c08de628 Mon Sep 17 00:00:00 2001 From: Jim Myhrberg Date: Fri, 15 Apr 2011 17:42:48 +0100 Subject: [PATCH] additional specs for Redistat::Buffer, still a few more needed --- spec/buffer_spec.rb | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/spec/buffer_spec.rb b/spec/buffer_spec.rb index e202a2f..9158464 100644 --- a/spec/buffer_spec.rb +++ b/spec/buffer_spec.rb @@ -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