spec/lib/metricize_spec.rb in metricize-0.4.6 vs spec/lib/metricize_spec.rb in metricize-0.4.7
- old
+ new
@@ -19,11 +19,11 @@
Timecop.return
forwarder.send(:clear_queue)
end
it "provides null object implementations to allow for easily disabling metrics functionality" do
- expect(Metricize::NullClient).to respond_to(:new, :increment, :measure, :time)
+ expect(Metricize::NullClient).to respond_to(:new, :increment, :measure, :time, :establish_redis_connection)
expect(Metricize::NullForwarder).to respond_to(:new, :go!)
end
it "properly uses the remote API to send gauge stats" do
client.increment('stat.name', :source => 'my_source')
@@ -121,12 +121,14 @@
end
forwarder.go!
end
it "logs in splunk format a sampling of metrics" do
- logger.should_receive(:info).with(/prefix_value1=10.0/m).at_least(5).times
+ 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).at_most(20).times
+ logger.should_receive(:info).with(/prefix_value2=20.0/m).exactly(6).times
100.times { client.measure('value2', 20) }
end
it "raises an error when measure is called without a numeric value" do
expect { client.measure('boom', {}) }.to raise_error(ArgumentError, /no numeric value provided in measure call/)