Sha256: a77c84b011cbd794df4a18279a430b929ff241275d8a2755699b4614c72de9c7

Contents?: true

Size: 579 Bytes

Versions: 4

Compression:

Stored size: 579 Bytes

Contents

require 'spec_helper'
require 'napa/stats_d_timer'

class FooTimer
  include Napa::StatsDTimer
end

describe Napa::StatsDTimer do
  before do
    # Delete any prevous instantiations of the emitter
    Napa::Stats.emitter = nil
    # Stub out logging since there is no log to output to
    allow(Napa::Logger).to receive_message_chain(:logger, :warn)
  end

  it 'logs a timing event based on how long the block takes' do
    expect(Napa::Stats.emitter).to receive(:timing).with('foo', an_instance_of(Float))
    FooTimer.report_time('foo') do
      sleep(0.1)
    end
  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
napa-0.5.0 spec/stats_d_timer_spec.rb
napa-0.4.3 spec/stats_d_timer_spec.rb
napa-0.4.1 spec/stats_d_timer_spec.rb
napa-0.4.0 spec/stats_d_timer_spec.rb