Sha256: b217768ad987246a1af6e6a123bced701b2efe6200ccf0ee1b610cec73896322

Contents?: true

Size: 829 Bytes

Versions: 2

Compression:

Stored size: 829 Bytes

Contents

RSpec.describe NanomsgTransport do
  let(:host) { 'tcp://127.0.0.1:7250' }
  let(:message) { SecureRandom.hex }

  xit 'should work for REQREP' do
    server = NanomsgTransport.server(host) { |rec| @rec = rec }.start
    client = NanomsgTransport.client host

    client.post message

    server.stop
    client.close_socket

    expect(@rec).to eq message
  end

  it 'should work for PUBSUB' do
    publisher = NanomsgTransport.publisher(host)
    publisher.open_socket

    @reced = []

    subscriber = NanomsgTransport.subscriber(host) { |rec| @reced << rec }
    subscriber.add_subscription('foo').start

    sleep 0.1

    publisher.publish 'foobar'
    publisher.publish 'bazbar'

    publisher.close_socket
    subscriber.stop

    expect(@reced).to include 'foobar'
    expect(@reced).to_not include 'bazbar'
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
aggro-0.0.3 spec/lib/aggro/nanomsg_transport_spec.rb
aggro-0.0.2 spec/lib/aggro/nanomsg_transport_spec.rb