Sha256: d153c6334d8b2ed9c65d8fdeb4e000807db152017c2fcf64e3dc41d0db8acaa1

Contents?: true

Size: 1.6 KB

Versions: 7

Compression:

Stored size: 1.6 KB

Contents

require 'spec_helper.rb'

describe Metrics::Agent do
  before :each do 
    @agent = Metrics::Agent.new
  end
  
  it "should create a new agent" do  
  end
  
  it "should add a counter instrument correctly" do 
    @counter = Metrics::Instruments::Counter.new
    Metrics::Instruments::Counter.stub!(:new).and_return @counter
    @agent.counter(:test_counter).should == @counter
  end
  
  it "should allow for creating a gauge with a block via #gauge" do 
    @agent.gauge :test_gauge do 
      "result"
    end
  end
  
  it "should add a Histogram instrument using uniform sampling" do
    histogram = Metrics::Instruments::UniformHistogram.new
    Metrics::Instruments::UniformHistogram.stub!(:new).and_return histogram
    @agent.uniform_histogram(:test_histogram).should == histogram
  end

  it "should allow for registering a Histogram instrument using exponentially decaying sampling" do
    histogram = Metrics::Instruments::ExponentialHistogram.new
    Metrics::Instruments::ExponentialHistogram.stub!(:new).and_return histogram
    @agent.exponential_histogram(:test_histogram).should == histogram
  end  

  it "should set up a histogram using uniform distribution if just a histogram is registered" do
    histogram = Metrics::Instruments::UniformHistogram.new
    Metrics::Instruments::UniformHistogram.stub!(:new).and_return histogram
    @agent.histogram(:test_histogram).should == histogram
  end
  
  it "should add a meter instrument correctly" do
    @meter = Metrics::Instruments::Meter.new
    Metrics::Instruments::Meter.stub!(:new).and_return @meter

    @agent.meter(:test_meter).should == @meter
  end
  
end

Version data entries

7 entries across 7 versions & 2 rubygems

Version Path
yam-ruby-metrics-0.8.9 spec/agent_spec.rb
yam-ruby-metrics-0.8.8 spec/agent_spec.rb
yam-ruby-metrics-0.8.7 spec/agent_spec.rb
yam-ruby-metrics-0.8.6 spec/agent_spec.rb
ruby-metrics-0.8.6 spec/agent_spec.rb
ruby-metrics-0.8.5 spec/agent_spec.rb
ruby-metrics-0.8.0 spec/agent_spec.rb