Sha256: ada0a15be737955c4de070fda6c87091d90a0eb277cf2cb62506f06b698315f0

Contents?: true

Size: 895 Bytes

Versions: 7

Compression:

Stored size: 895 Bytes

Contents

context 'Servers' do
  setup do
    @context = EZMQ::Context.new
    options = { transport: :inproc, address: 'test', context: @context }
    @server = EZMQ::Server.new options
    @client = EZMQ::Client.new options
    Thread.new do
      @client.request 'message'
    end
  end

  should 'yield the contents of a request, if given a block' do
    assert_nothing_raised do
      Timeout.timeout(0.1) do
        @server.listen do |request|
          assert_equal request, 'message'
          break
        end
      end
    end
  end

  should 'return the length of messages they send' do
    @server.receive
    assert_equal 7, @server.send('message')
  end

  should 'return the contents of a request they receive' do
    assert_equal 'message', @server.receive
  end

  should 'yield the contents of reply, if given a block' do
    assert_equal 'message', @server.receive { |m| m }
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
ezmq-0.4.12 tests/ezmq/reply.rb
ezmq-0.4.11 tests/ezmq/reply.rb
ezmq-0.4.4 tests/ezmq/reply.rb
ezmq-0.4.3 tests/ezmq/reply.rb
ezmq-0.4.2 tests/ezmq/reply.rb
ezmq-0.4.1 tests/ezmq/reply.rb
ezmq-0.4.0 tests/ezmq/reply.rb