Sha256: 8db196fd93514d7c91c95a0a23d25eef17adaea170e51258fbbde2150a7a6e9a

Contents?: true

Size: 1.96 KB

Versions: 1

Compression:

Stored size: 1.96 KB

Contents

require 'spec_helper'

describe Archimedes do

  before do
    @config = stub(host: 'example.org', port: 9999, namespace: 'test.archimedes')
    @archimedes = described_class.new(@config)
  end

  describe '.increment' do
    it 'calls the service\'s count method with 1' do
      @archimedes.service.expects(:count).with('foo.metric', 1, 1)
      @archimedes.increment('foo.metric')
    end

    it 'passes the rate along if present' do
      @archimedes.service.expects(:count).with(anything, 1, 0.25)
      @archimedes.increment(anything, 0.25)
    end
  end

  describe '.decrement' do
    it 'calls the service\'s count method with -1' do
      @archimedes.service.expects(:count).with('bar.metric', -1, 1)
      @archimedes.decrement('bar.metric')
    end

    it 'passes the rate along if present' do
      @archimedes.service.expects(:count).with(anything, -1, 0.9)
      @archimedes.decrement(anything, 0.9)
    end
  end

  describe '.count' do
    it 'calls the service\'s count method with the count size' do
      @archimedes.service.expects(:count).with('baz.metric', 12, 1)
      @archimedes.count('baz.metric', 12)
    end

    it 'passes the rate along if present' do
      @archimedes.service.expects(:count).with(anything, -15, 0.75)
      @archimedes.count(anything, -15, 0.75)
    end
  end

  describe '.gauge' do
    it 'calls the service\'s gauge method' do
      @archimedes.service.expects(:gauge).with('sk.gauge', 11, 1)
      @archimedes.gauge('sk.gauge', 11)
    end

    it 'passes the rate along if present' do
      @archimedes.service.expects(:gauge).with(anything, 6, 0.1)
      @archimedes.gauge(anything, 6, 0.1)
    end
  end

  describe '.time' do
    it 'calls the service\'s time method' do
      @archimedes.service.expects(:time).with('sk.time', 1)
      @archimedes.time('sk.time') {}
    end

    it 'passes the rate along if present' do
      @archimedes.service.expects(:time).with('sk.time', 0.1)
      @archimedes.time('sk.time', 0.1) {}
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
archimedes-0.0.1 spec/lib/archimedes_spec.rb