Sha256: e494daceefb58ac1aead9e793f02b7ccf3ae30fa053bd56d3ec1b66c6b8bc561
Contents?: true
Size: 1.19 KB
Versions: 1
Compression:
Stored size: 1.19 KB
Contents
require 'spec_helper' require 'instrumental' class Agent;end describe 'public instrument methods' do before(:each) do Agent.stub(:instance).and_return(@mock_agent_instance = mock(:agent_instance)) end describe "count" do context "without a value" do it "should send a value of 1" do @mock_agent_instance.should_receive(:report).with(:count, 'my name', 1) Instrumental.count('my name') end end context "with a value" do it "should send the passed value" do @mock_agent_instance.should_receive(:report).with(:count, 'my name', 23) Instrumental.count('my name', 23) end end end describe "measure" do it "should send the passed value" do @mock_agent_instance.should_receive(:report).with(:measure, 'my name', 19.2) Instrumental.measure('my name', 19.2) end end describe "timer" do it "should send the calculated time" do delta = 1.574 Time.should_receive(:now).and_return(0) Time.should_receive(:now).and_return(delta) @mock_agent_instance.should_receive(:report).with(:measure, 'my name', delta*1000) Instrumental.timer('my name') { 'do stuff' } end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
instrumental-0.1.5 | spec/instrumental/instrument_methods_spec.rb |