Sha256: 1538dd21c6b8fd8fabae497ecfb202534f2247be4fb85a26382bb147bc824ccd

Contents?: true

Size: 782 Bytes

Versions: 5

Compression:

Stored size: 782 Bytes

Contents

require 'test_helper'
require 'securerandom'

module M2R
  class ConnectionFactoryTest < MiniTest::Unit::TestCase
    def test_factory
      sender_id = "sid"
      request_addr = "req"
      response_addr = "req"

      pull    = stub(:pull)
      pub     = stub(:pub)
      context = stub(:context)

      context.expects(:socket).with(ZMQ::PULL).returns(pull)
      context.expects(:socket).with(ZMQ::PUB).returns(pub)

      pull.expects(:connect).with(request_addr)

      pub.expects(:connect).with(response_addr)
      pub.expects(:setsockopt).with(ZMQ::IDENTITY, sender_id)

      Connection.expects(:new).with(pull, pub)
      cf = ConnectionFactory.new ConnectionFactory::Options.new(sender_id, request_addr, response_addr), context
      cf.connection
    end

  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
m2r-2.1.0 test/unit/connection_factory_test.rb
m2r-2.1.0.pre test/unit/connection_factory_test.rb
m2r-2.0.2 test/unit/connection_factory_test.rb
m2r-2.0.1 test/unit/connection_factory_test.rb
m2r-2.0.0 test/unit/connection_factory_test.rb