Sha256: eb1603d87bb55b20c576301c8a27f32220735f5b16b42dc19c9b08447135ebb5

Contents?: true

Size: 941 Bytes

Versions: 11

Compression:

Stored size: 941 Bytes

Contents

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

describe FnordMetric::UDPAcceptor do

  let(:inbound_datagram) { FnordMetric::UDPAcceptor.new(nil) }

  before(:all) do
    @redis = Redis.new
    @redis_wrap = RedisWrap.new(@redis)
    FnordMetric::UDPAcceptor.opts = {
      :redis_url => "redis://localhost:6379",
      :redis_prefix => "fnordmetric-test",
      :event_queue_ttl => 120
    }
  end

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

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

    it "should reject non parsable events" do
      broken_data = %Q{{"_type" => "started"}}

      lambda {
        inbound_datagram.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/udp_acceptor_spec.rb
fnordmetric-1.2.9 spec/udp_acceptor_spec.rb
johnf-fnordmetric-1.2.7 spec/udp_acceptor_spec.rb
bp-fnordmetric-1.2.7 spec/udp_acceptor_spec.rb
fnordmetric-1.2.7 spec/udp_acceptor_spec.rb
fnordmetric-1.2.6 spec/udp_acceptor_spec.rb
fnordmetric-1.2.4 spec/udp_acceptor_spec.rb
fnordmetric-1.2.1 spec/udp_acceptor_spec.rb
fnordmetric-1.2.0 spec/udp_acceptor_spec.rb
fnordmetric-1.0.1 spec/udp_acceptor_spec.rb
fnordmetric-1.0.0 spec/udp_acceptor_spec.rb