File: registry_test.rb

package info (click to toggle)
ruby-metriks 0.9.9.8-3.1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 288 kB
  • sloc: ruby: 1,877; makefile: 2
file content (49 lines) | stat: -rw-r--r-- 972 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
require 'test_helper'

require 'metriks/registry'

class RegistryTest < Test::Unit::TestCase
  def setup
    @registry = Metriks::Registry.new
  end

  def teardown
    @registry.stop
  end

  def test_counter
    assert_not_nil @registry.counter('testing')
  end

  def test_meter
    assert_not_nil @registry.meter('testing')
  end

  def test_timer
    assert_not_nil @registry.timer('testing')
  end

  def test_utilization_timer
    assert_not_nil @registry.utilization_timer('testing')
  end

  def test_histogram
    assert_not_nil @registry.histogram('testing')
  end

  def test_mismatched_metrics
    @registry.histogram('histogram')
    assert_raises(RuntimeError) { @registry.timer('histogram') }

    @registry.timer('timer')
    assert_raises(RuntimeError) { @registry.histogram('timer') }
  end

  def test_calling_counter_twice
    assert_not_nil @registry.counter('testing')
  end

  def test_default
    assert_not_nil Metriks::Registry.default
  end
end