Sha256: 1898c68b36c6761b6377d3c5f27ac2364f0bda6a79fcc87a92fac41dde52e00f

Contents?: true

Size: 927 Bytes

Versions: 3

Compression:

Stored size: 927 Bytes

Contents

context 'Clients' 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
      @server.listen
    end
  end

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

  should 'return the contents of messages they receive' do
    @client.send 'message'
    assert_equal 'message', @client.receive
  end

  should 'return the reply from a request they send' do
    assert_equal 'message', @client.request('message')
  end

  should 'yield the contents of reply, if given a block' do
    assert_equal 'message', @client.request('message') { |m| m }
  end

  should 'pass Hash messages to the encode method' do
    @client.encode = -> m { assert_equal({message: 'test'}, m) }
    @client.request message: 'test'
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ezmq-0.4.12 tests/ezmq/request.rb
ezmq-0.4.11 tests/ezmq/request.rb
ezmq-0.4.4 tests/ezmq/request.rb