Sha256: f49a1c7dd495fdbc24ec65003c677f68e590800f4d20a0dcb0a197eb1598a5ad

Contents?: true

Size: 815 Bytes

Versions: 1

Compression:

Stored size: 815 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"
      request_parser = Object.new

      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, request_parser)
      cf = ConnectionFactory.new sender_id, request_addr, response_addr, request_parser, context
      cf.connection
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
m2r-1.0.0 test/unit/connection_factory_test.rb