Sha256: 39f1ba396ca7071655b82ae8e2b29cb3a7a2ad3f1dc795a5d37b7f60b6817213

Contents?: true

Size: 952 Bytes

Versions: 1

Compression:

Stored size: 952 Bytes

Contents

require 'spec_helper'

module Appstats
  describe Benchmarker do

    before(:each) do
      @redis = InmemoryRedis.new
      @benchmarker = Benchmarker.new(:redis => @redis) 
    end

    describe "#initialize" do
      
      it "should default to redis" do
        Benchmarker.new.redis.should_not == nil
      end

      it "should be settable" do
        @benchmarker.redis.should == @redis
      end
      
    end
    
    describe "record" do
      
      it "should track the title, legend, and point" do
        @benchmarker.record("BuildDuration","Appstats","15")
        @redis.scard("benchmarks").should == 1
        @redis.scard("benchmarks:BuildDuration").should == 1
        @redis.lrange("benchmarks:BuildDuration:Appstats",0,-1).should == ["15"]

        @benchmarker.record("BuildDuration","Appstats","20")
        @redis.lrange("benchmarks:BuildDuration:Appstats",0,-1).should == ["15","20"]

      end
      
    end
    
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
appstats-0.23.0 spec/benchmarker_spec.rb