Sha256: c9f9d87262d125044b25927e0a288a11f1255b81eb8ef3d66daecebc621f6a72

Contents?: true

Size: 1.1 KB

Versions: 25

Compression:

Stored size: 1.1 KB

Contents

require ::File.expand_path('../spec_helper.rb', __FILE__)

describe FnordMetric::Context do

  before(:all) do
    @redis = Redis.new
    @redis_wrap = RedisWrap.new(@redis)
  end

  before(:each) do
    @redis.keys("fnordmetrictest*").each { |k| @redis.del(k) }  
  end

  it "should fetch a gauge by key"
  it "should fetch a gauge by gauge"
  it "should raise an error if unable to fetch a gauge"

  it "should expose the current session_key" do
    ns = FnordMetric::Namespace.new(
      :myns_253,
      :redis_prefix => "fnordmetrictest"      
    )
    ns.opt_event(:fnordbar, {}) do
      session_key.should == "145d3f6dee1a770e3a3c550b3993dc81"
    end
    ns.ready!(@redis_wrap).announce(
      :_eid => "35r2423",
      :_time => Time.now.to_i, 
      :_type => "fnordbar", 
      :_session => "sess213"
    )
  end

  it "should instance-eval the handler on call" do 
    Thread.current["fnord_123"] = false
    my_block = proc{ Thread.current["fnord_123"] = "35r25" }   
    context = FnordMetric::Context.new({}, my_block)
    context.call({}, nil)
    Thread.current["fnord_123"].should == "35r25"
  end

end

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
fnordmetric-1.0.1 spec/context_spec.rb
fnordmetric-1.0.0 spec/context_spec.rb
fnordmetric-0.9.7 spec/context_spec.rb
fnordmetric-0.7.5 spec/context_spec.rb
fnordmetric-0.7.4 spec/context_spec.rb
fnordmetric-0.7.3 spec/context_spec.rb
fnordmetric-0.7.1 spec/context_spec.rb
fnordmetric-0.7.0 spec/context_spec.rb
fnordmetric-0.6.6 spec/context_spec.rb
fnordmetric-0.6.5 spec/context_spec.rb
fnordmetric-0.6.4 spec/context_spec.rb
fnordmetric-0.6.3 spec/context_spec.rb
fnordmetric-0.6.2 spec/context_spec.rb
fnordmetric-0.6.1 spec/context_spec.rb
fnordmetric-0.6.0 spec/context_spec.rb
fnordmetric-0.5.9 spec/context_spec.rb
fnordmetric-0.5.8 spec/context_spec.rb
fnordmetric-0.5.7 spec/context_spec.rb
fnordmetric-0.5.6 spec/context_spec.rb
fnordmetric-0.5.5 spec/context_spec.rb