Sha256: 5a0d43355b6fc23780c90d8397c79c38caadf8fec19e339a0cad4ad3afc5ba94

Contents?: true

Size: 650 Bytes

Versions: 4

Compression:

Stored size: 650 Bytes

Contents

# frozen_string_literal: true

require 'test_helper'

class HelpersTest < Minitest::Test
  def setup
    test_class = Class.new(Minitest::Test)
    test_class.send(:include, StatsD::Instrument::Helpers)
    @test_case = test_class.new('fake')
  end

  def test_capture_metrics_inside_block_only
    StatsD.increment('counter')
    metrics = @test_case.capture_statsd_calls do
      StatsD.increment('counter')
      StatsD.gauge('gauge', 12)
    end
    StatsD.gauge('gauge', 15)

    assert_equal 2, metrics.length
    assert_equal 'counter', metrics[0].name
    assert_equal 'gauge', metrics[1].name
    assert_equal 12, metrics[1].value
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
statsd-instrument-2.6.0 test/helpers_test.rb
statsd-instrument-2.5.1 test/helpers_test.rb
statsd-instrument-2.5.0 test/helpers_test.rb
statsd-instrument-2.4.0 test/helpers_test.rb