Sha256: 4140b1325f99a668d8fc90c28d441dc081a117c9ee8d8245a32fbe08c0e22ca2

Contents?: true

Size: 936 Bytes

Versions: 11

Compression:

Stored size: 936 Bytes

Contents

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

Version data entries

11 entries across 11 versions & 3 rubygems

Version Path
johnf-fnordmetric-1.2.10 spec/tcp_acceptor_spec.rb
fnordmetric-1.2.9 spec/tcp_acceptor_spec.rb
johnf-fnordmetric-1.2.7 spec/tcp_acceptor_spec.rb
bp-fnordmetric-1.2.7 spec/tcp_acceptor_spec.rb
fnordmetric-1.2.7 spec/tcp_acceptor_spec.rb
fnordmetric-1.2.6 spec/tcp_acceptor_spec.rb
fnordmetric-1.2.4 spec/tcp_acceptor_spec.rb
fnordmetric-1.2.1 spec/tcp_acceptor_spec.rb
fnordmetric-1.2.0 spec/tcp_acceptor_spec.rb
fnordmetric-1.0.1 spec/tcp_acceptor_spec.rb
fnordmetric-1.0.0 spec/tcp_acceptor_spec.rb