Sha256: b76319da387673aee71ef830ded3c83d59faef0488224f4c89d0d4a0ec2ac164

Contents?: true

Size: 1.25 KB

Versions: 16

Compression:

Stored size: 1.25 KB

Contents

require 'spec_helper'
require 'lookout/rack/utils/graphite'

describe Lookout::Rack::Utils::Graphite do
  subject(:graphite) { described_class }

  before :each do
    graphite.instance # Initialize statsd singleton
    configatron.statsd.stub(:prefix).and_return('test')
  end

  context 'offers statsd methods' do
    it { should respond_to :increment }
    it { should respond_to :decrement }
    it { should respond_to :timing }
    it { should respond_to :update_counter }
  end

  it 'should delegate to statsd' do
    Statsd.instance.should_receive(:increment).once.with('device.associated')
    Lookout::Rack::Utils::Graphite.increment('device.associated')
  end

  describe '#timing' do
    it 'should delegate the block to statsd' do
      expect { |block|
        Statsd.instance.should_receive(:timing).once.with('device.became_aware', &block)
        Lookout::Rack::Utils::Graphite.timing('device.became_aware', &block)
      }.to yield_control
    end

    it 'should delegate the sample rate and block to statsd' do
      expect { |block|
        Statsd.instance.should_receive(:timing).once.with('device.became_aware', 0.05, &block)
        Lookout::Rack::Utils::Graphite.timing('device.became_aware', 0.05, &block)
      }.to yield_control
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
lookout-rack-utils-3.3.0.24 spec/graphite_spec.rb
lookout-rack-utils-3.3.0.22 spec/graphite_spec.rb
lookout-rack-utils-3.2.0.19 spec/graphite_spec.rb
lookout-rack-utils-3.2.0.16 spec/graphite_spec.rb
lookout-rack-utils-3.1.0.12 spec/graphite_spec.rb
lookout-rack-utils-3.0.1.11 spec/graphite_spec.rb
lookout-rack-utils-3.0.1 spec/graphite_spec.rb
lookout-rack-utils-3.0.0 spec/graphite_spec.rb
lookout-rack-utils-2.0.0 spec/graphite_spec.rb
lookout-rack-utils-1.7.3 spec/graphite_spec.rb
lookout-rack-utils-1.7.2 spec/graphite_spec.rb
lookout-rack-utils-1.7.1 spec/graphite_spec.rb
lookout-rack-utils-1.6.0 spec/graphite_spec.rb
lookout-rack-utils-1.5.0 spec/graphite_spec.rb
lookout-rack-utils-1.4.0 spec/graphite_spec.rb
lookout-rack-utils-1.3.0 spec/graphite_spec.rb