Skip to content
This repository
branch: v0.9
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 36 lines (28 sloc) 0.936 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
require ::File.expand_path('../spec_helper.rb', __FILE__)

describe FnordMetric::TCPAcceptor do

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

  describe "pushing new events" do
    it "should add parsable event to the queue" do
      pending "fixme"
      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

Something went wrong with that request. Please try again.