Sha256: 4bb5ea4f27e06db0e2d92f353031c107a2657716e5a747d1d21d90841fffaf75

Contents?: true

Size: 794 Bytes

Versions: 10

Compression:

Stored size: 794 Bytes

Contents

# frozen_string_literal: true

require 'test_helper'

class CaptureBackendTest < Minitest::Test
  def setup
    @backend = StatsD::Instrument::Backends::CaptureBackend.new
    @metric1 = StatsD::Instrument::Metric.new(type: :c, name: 'mock.counter')
    @metric2 = StatsD::Instrument::Metric.new(type: :ms, name: 'mock.measure', value: 123)
  end

  def test_collecting_metric
    assert @backend.collected_metrics.empty?
    @backend.collect_metric(@metric1)
    @backend.collect_metric(@metric2)
    assert_equal [@metric1, @metric2], @backend.collected_metrics
  end

  def test_reset
    @backend.collect_metric(@metric1)
    @backend.reset
    assert @backend.collected_metrics.empty?
    @backend.collect_metric(@metric2)
    assert_equal [@metric2], @backend.collected_metrics
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
statsd-instrument-2.9.2 test/capture_backend_test.rb
statsd-instrument-2.9.1 test/capture_backend_test.rb
statsd-instrument-2.9.0 test/capture_backend_test.rb
statsd-instrument-2.8.0 test/capture_backend_test.rb
statsd-instrument-2.7.1 test/capture_backend_test.rb
statsd-instrument-2.7.0 test/capture_backend_test.rb
statsd-instrument-2.6.0 test/capture_backend_test.rb
statsd-instrument-2.5.1 test/capture_backend_test.rb
statsd-instrument-2.5.0 test/capture_backend_test.rb
statsd-instrument-2.4.0 test/capture_backend_test.rb