Sha256: 0f00806e44e752dab26d9449fba01767c2e08d2b63c03f31779ef5993092233c

Contents?: true

Size: 1.38 KB

Versions: 1

Compression:

Stored size: 1.38 KB

Contents

require 'bundler/setup'

require 'simplecov'
SimpleCov.start

require 'harness'

require 'minitest/unit'
require 'minitest/autorun'

Thread.abort_on_exception = true

class MiniTest::Unit::TestCase
  def setup
    Harness.config.collector = Harness::FakeCollector.new
    Harness.config.queue = Harness::SyncQueue.new
  end

  def assert_timer(name)
    refute_empty timers
    timer = timers.find { |t| t.name == name }
    assert timer, "Timer #{name} not logged!"
  end

  def assert_increment(name)
    refute_empty increments
    increment = increments.find { |i| i.name == name }
    assert increment, "Increment #{name} not logged!"
  end

  def assert_decrement(name)
    refute_empty decrements
    decrement = decrements.find { |i| i.name == name }
    assert decrement, "decrement #{name} not logged!"
  end

  def assert_gauge(name)
    refute_empty gauges
    gauge = gauges.find { |g| g.name == name }
    assert gauge, "gauge #{name} not logged!"
  end

  def assert_counter(name)
    refute_empty counters
    counter = counters.find { |g| g.name == name }
    assert counter, "counter #{name} not logged!"
  end

  def collector
    Harness.config.collector
  end

  def timers
    collector.timers
  end

  def increments
    collector.increments
  end

  def decrements
    collector.decrements
  end

  def counters
    collector.counters
  end

  def gauges
    collector.gauges
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
harness-2.0.0 test/test_helper.rb