spec/client_spec.rb in metricsd-0.2.4 vs spec/client_spec.rb in metricsd-0.2.5

- old
+ new

@@ -12,11 +12,10 @@ describe 'connection' do it 'should not throw, but log exceptions on failure' do @socket.should_receive(:send).and_raise(Errno::ECONNREFUSED.new('exception from test')) Metricsd.logger.should_receive(:error).once.with(match(/exception from test/)) - Metricsd.logger.should_receive(:error).at_least(1) # stacktrace Metricsd::Client.record_value('custom.metric', 5) end it 'should not send anything to the socket if disabled' do Metricsd.disable! @@ -115,9 +114,16 @@ Metricsd::Client.record_time('custom.metric') do yielded = true sleep 0.1 end yielded.should be_true + end + + it 'should return block value' do + @socket.should_receive(:send).with(match(/all@custom.metric.time:\d+/), 0) + Metricsd::Client.record_time('custom.metric') do + 'hello' + end.should eq('hello') end it 'should use options if time is not specified' do @socket.should_receive(:send).with(match(/all@custom.metric.time:\d+/), 0) yielded = false