Sha256: 4cfc6174ae3933eef5bec1a8f26363bb7646c2c45ebef7888ec06a3b6357017e

Contents?: true

Size: 707 Bytes

Versions: 3

Compression:

Stored size: 707 Bytes

Contents

require File.expand_path('../test_helper', __FILE__)

module Propono
  class UdpListenerTest < Minitest::Test

    def test_initialize_should_fail_without_a_block
      assert_raises(UdpListenerError) do
        UdpListener.new
      end
    end

    def test_message_is_processed
      text = "Foobar123"
      processor = Proc.new {}
      server = UdpListener.new &processor
      socket = mock(recvfrom: [text])
      server.stubs(socket: socket)
      processor.expects(:call).with(text)
      thread = server.send(:receive_and_process)
      thread.join
    end

    def test_listen_should_loop
      listener = UdpListener.new {}
      listener.expects(:loop)
      listener.listen
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
propono-0.5.3 test/udp_listener.rb
propono-0.5.2 test/udp_listener.rb
propono-0.5.1 test/udp_listener.rb