Sha256: 73c2fb8d624dea1ec90a499a99ac272af7bd5d8cffe4f95c2976da4782d9cb51

Contents?: true

Size: 1.31 KB

Versions: 3

Compression:

Stored size: 1.31 KB

Contents

require_relative "../test_helper"
require "loggerator/metrics"

class TestLoggeratorMetrics < Minitest::Test
  include Loggerator
  include Loggerator::Metrics

  def config
    Loggerator.config
  end

  def test_name_equals
    config.metrics_app_name = "test_name_equals"

    assert_equal "test_name_equals", config.metrics_app_name
  end

  def test_name
    config.metrics_app_name = "test_name"

    assert_equal "test_name", self.name
  end

  def test_count
    config.metrics_app_name = "test_count"
    out, err = capture_subprocess_io do
      self.count(:foo, 99)
    end

    assert_empty err
    assert_match(/count#test_count\.foo=99/, out)
  end

  def test_sample
    config.metrics_app_name = "test_sample"
    out, err = capture_subprocess_io do
      self.sample(:foo, :bar)
    end

    assert_empty err
    assert_match(/sample#test_sample\.foo=bar/, out)
  end

  def test_unique
    config.metrics_app_name = "test_unique"
    out, err = capture_subprocess_io do
      self.unique(:foo, :bar)
    end

    assert_empty err
    assert_match(/unique#test_unique\.foo=bar/, out)
  end

  def test_measure
    config.metrics_app_name = "test_measure"
    out, err = capture_subprocess_io do
      self.measure(:foo, 60, "ms")
    end

    assert_empty err
    assert_match(/measure#test_measure\.foo=60ms/, out)
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
loggerator-0.1.3 test/loggerator/metrics_test.rb
loggerator-0.1.2 test/loggerator/metrics_test.rb
loggerator-0.1.1 test/loggerator/metrics_test.rb