Sha256: ac9bcbbbebc00e5363fcf0c280a38f0a3b5e738c81cafb5132764017f70af568

Contents?: true

Size: 921 Bytes

Versions: 28

Compression:

Stored size: 921 Bytes

Contents

module Macmillan
  module Utils
    ##
    # A test helper class for stubbing out interaction with StatsD.
    #
    # === Usage (in spec/spec_helper.rb):
    #
    #   require 'macmillan/utils/statsd_stub'
    #
    #   RSpec.configure do |config|
    #     config.before(:suite) do
    #       $statsd = Macmillan::Utils::StatsdStub.new
    #     end
    #   end
    #
    # @see Macmillan::Utils::StatsdDecorator
    # @see http://rubygems.org/gems/statsd-ruby
    #
    class StatsdStub
      def increment(_stat, _sample_rate = 1)
      end

      def decrement(_stat, _sample_rate = 1)
      end

      def count(_stat, _count, _sample_rate = 1)
      end

      def guage(_stat, _value, _sample_rate = 1)
      end

      def set(_stat, _value, _sample_rate = 1)
      end

      def timing(_stat, _ms, _sample_rate = 1)
      end

      def time(_stat, _sample_rate = 1)
        yield
      end
    end
  end
end

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
macmillan-utils-1.0.44 lib/macmillan/utils/statsd_stub.rb
macmillan-utils-1.0.43 lib/macmillan/utils/statsd_stub.rb
macmillan-utils-1.0.42 lib/macmillan/utils/statsd_stub.rb
macmillan-utils-1.0.41 lib/macmillan/utils/statsd_stub.rb
macmillan-utils-1.0.40 lib/macmillan/utils/statsd_stub.rb
macmillan-utils-1.0.39 lib/macmillan/utils/statsd_stub.rb
macmillan-utils-1.0.38 lib/macmillan/utils/statsd_stub.rb
macmillan-utils-1.0.37 lib/macmillan/utils/statsd_stub.rb
macmillan-utils-1.0.36 lib/macmillan/utils/statsd_stub.rb
macmillan-utils-1.0.35 lib/macmillan/utils/statsd_stub.rb
macmillan-utils-1.0.34 lib/macmillan/utils/statsd_stub.rb
macmillan-utils-1.0.33 lib/macmillan/utils/statsd_stub.rb
macmillan-utils-1.0.32 lib/macmillan/utils/statsd_stub.rb
macmillan-utils-1.0.31 lib/macmillan/utils/statsd_stub.rb
macmillan-utils-1.0.30 lib/macmillan/utils/statsd_stub.rb
macmillan-utils-1.0.29 lib/macmillan/utils/statsd_stub.rb
macmillan-utils-1.0.27 lib/macmillan/utils/statsd_stub.rb
macmillan-utils-1.0.23 lib/macmillan/utils/statsd_stub.rb
macmillan-utils-1.0.22 lib/macmillan/utils/statsd_stub.rb
macmillan-utils-1.0.21 lib/macmillan/utils/statsd_stub.rb