Sha256: 737af934b42e74655aa9dffe7f1dc621402116a0265eb8c7ea0a7a57d8484238

Contents?: true

Size: 920 Bytes

Versions: 3

Compression:

Stored size: 920 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

3 entries across 3 versions & 1 rubygems

Version Path
fnordmetric-0.7.5 spec/inbound_stream_spec.rb
fnordmetric-0.7.4 spec/inbound_stream_spec.rb
fnordmetric-0.7.3 spec/inbound_stream_spec.rb