Sha256: c1c7bcc5fd0f72bdc41ccc82c8058c2e735d9ec14d77f8dfaea72a080e7f1276
Contents?: true
Size: 851 Bytes
Versions: 10
Compression:
Stored size: 851 Bytes
Contents
require File.join(File.dirname(__FILE__), %w[.. spec_helper]) describe Endeca::Benchmarking do class Helper extend Endeca::Benchmarking end describe "#benchmark" do before do @logger = mock('Logger') Endeca.stub!(:logger).and_return(@logger) Endeca.stub!(:debug => true, :benchmark => true) Benchmark.stub!(:ms => 1) end it "should log the title and the time to the Endeca logger" do @logger.should_receive(:debug).with("metric: 1.0ms") Endeca.bm(:metric){ 1 } end end describe "#add_bm_detail" do it "should add info to the current thread" do Endeca.stub!(:analyze?).and_return(true) Endeca.send(:add_bm_detail, :metric, 1.1, 'query query') Thread.current[:endeca]["metric_detail"][0].should == {:detail => "query query", :time => 1.1} end end end
Version data entries
10 entries across 10 versions & 2 rubygems