spec/lib/metricize_spec.rb in metricize-0.5.0 vs spec/lib/metricize_spec.rb in metricize-0.5.1

- old
+ new

@@ -6,11 +6,11 @@ let(:logger) { double.as_null_object } let(:forwarder) { Metricize::Forwarder.new( :password => 'api_key', :username => 'name@example.com', :logger => logger) } - let(:client) { Metricize::Client.new( :prefix => 'prefix', :logger => logger ) } + let(:client) { Metricize::Client.new( :prefix => 'prefix', :logger => logger, :log_sampling_ratio => 1.0 ) } before do Timecop.freeze(Time.at(1234)) RestClient.stub(:post) end @@ -55,11 +55,11 @@ RestClient.should_not_receive(:post) forwarder.go! end it "limits the number of metrics forwarded to the remote in a single request" do - forwarder.instance_variable_set(:@max_batch_size, 3) + forwarder.instance_variable_set(:@batch_size, 3) 7.times { | n| client.increment('stat.name' + n.to_s) } forwarder.go! expect(forwarder.send(:queue_length)).to eq 4 forwarder.go! expect(forwarder.send(:queue_length)).to eq 1 @@ -131,11 +131,11 @@ end forwarder.go! end it "logs in splunk format a sampling of metrics" do + client = Metricize::Client.new( :prefix => 'prefix', :logger => logger, :log_sampling_ratio => 0.10 ) srand(1234) - logger.should_receive(:info) # ignore initial connection message logger.should_receive(:info).with(/prefix_value1=10.0/m).exactly(9).times 100.times { client.measure('value1', 10) } logger.should_receive(:info).with(/prefix_value2=20.0/m).exactly(6).times 100.times { client.measure('value2', 20) } end