spec/client_spec.rb in metricsd-0.2.1 vs spec/client_spec.rb in metricsd-0.2.2
- old
+ new
@@ -21,9 +21,16 @@
it 'should not send anything to the socket if disabled' do
Metricsd.disable!
@socket.should_not_receive(:send)
Metricsd::Client.record_value('custom.metric', 5)
end
+
+ it 'should create and cache UDPSocket in collector_socket method' do
+ Metricsd::Client.unstub!(:collector_socket)
+ sock = Metricsd::Client.send(:collector_socket)
+ sock.should be_a(UDPSocket)
+ Metricsd::Client.send(:collector_socket).should be(sock)
+ end
end
describe '.record_hit' do
it 'should send two metrics in a single packet' do
@socket.should_receive(:send).with('all@custom.metric_count:1;all@custom.metric_time:450', 0)