Sha256: f9d3c1295989f2bef74b41594a22da6b524c7902130d7c1070dde63dd9f5fbaf

Contents?: true

Size: 924 Bytes

Versions: 6

Compression:

Stored size: 924 Bytes

Contents

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

describe FnordMetric::InboundStream do

  before(:all) do
    @redis = Redis.new
    @redis_wrap = RedisWrap.new(@redis)
    FnordMetric::InboundStream.options(
      :redis_url => "redis://localhost:6379",
      :redis_prefix => "fnordmetric-test",
      :event_queue_ttl => 120
    )
    @inbound_stream = FnordMetric::InboundStream.new(nil)
  end

  describe "pushing new events" do
    it "should add parsable event to the queue" do
      data = %Q{{"_type": "started"}\n}

      lambda {
        @inbound_stream.receive_data data
      }.should change { @redis.llen("fnordmetric-test-queue") }.by +1
    end

    it "should reject non parsable events" do
      broken_data = %Q{{"_type": \n"started"}\n}
    
      lambda {
        @inbound_stream.receive_data broken_data
      }.should_not change { @redis.llen("fnordmetric-test-queue") }
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
fnordmetric-0.7.1 spec/inbound_stream_spec.rb
fnordmetric-0.7.0 spec/inbound_stream_spec.rb
fnordmetric-0.6.6 spec/inbound_stream_spec.rb
fnordmetric-0.6.5 spec/inbound_stream_spec.rb
fnordmetric-0.6.4 spec/inbound_stream_spec.rb
fnordmetric-0.6.3 spec/inbound_stream_spec.rb