Sha256: 6de38d4baff849c1d3f3eb9d8984bf301dc8b2ef960e712b1340783f58c535f4

Contents?: true

Size: 869 Bytes

Versions: 24

Compression:

Stored size: 869 Bytes

Contents

require 'test_helper'

class CountersWithRedis < IntegrationTest
  def test_counters_can_act_like_gauges
    50.times { instrument "event-counter", :counter => true }

    meter = Harness::Meter.new 'event-counter'
    assert_equal 50, meter.per_second.value
    assert_equal 50, meter.per_minute.value
    assert_equal 50, meter.per_hour.value
  end

  def tests_raises_an_error_when_no_such_counter
    assert_raises Harness::NoCounter do
      Harness::Meter.new 'unknown-counter'
    end
  end

  def test_rates_return_gauges
    50.times { instrument "event-counter", :counter => true }

    meter = Harness::Meter.new 'event-counter'

    gauge = meter.per_second

    assert_kind_of Harness::Gauge, gauge

    assert_equal "event-counter-per-second", gauge.id
    assert_equal "event-counter per second", gauge.name
    assert_kind_of Time, gauge.time
  end
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
harness-0.8.1 test/integration/meter_test.rb
harness-0.8.0 test/integration/meter_test.rb
harness-0.7.0 test/integration/meter_test.rb
harness-0.6.0 test/integration/meter_test.rb
harness-0.5.0 test/integration/meter_test.rb
harness-0.4.0 test/integration/meter_test.rb
harness-0.3.0 test/integration/meter_test.rb
harness-0.2.16 test/integration/meter_test.rb
harness-0.2.15 test/integration/meter_test.rb
harness-0.2.14 test/integration/meter_test.rb
harness-0.2.13 test/integration/meter_test.rb
harness-0.2.12 test/integration/meter_test.rb
harness-0.2.11 test/integration/meter_test.rb
harness-0.2.10 test/integration/meter_test.rb
harness-0.2.9 test/integration/meter_test.rb
harness-0.2.8 test/integration/meter_test.rb
harness-0.2.7 test/integration/meter_test.rb
harness-0.2.6 test/integration/meter_test.rb
harness-0.2.5 test/integration/meter_test.rb
harness-0.2.4 test/integration/meter_test.rb