Sha256: 396db77cb6f9444b195f5af88ba71f4051a488fb6fb2bf41b0e182b8b55ea030
Contents?: true
Size: 938 Bytes
Versions: 4
Compression:
Stored size: 938 Bytes
Contents
require 'test_helper' require 'timeout' module M2R class ModuleTest < MiniTest::Unit::TestCase def setup if context = M2R.instance_variable_get(:@zmq_context) context.send(:remove_finalizer) if context.respond_to?(:remove_finalizer) M2R.instance_variable_set(:@zmq_context, nil) end end def test_mongrel2_context_getter assert_instance_of ZMQ::Context, M2R.zmq_context end def test_mongrel2_context_setter ctx = ZMQ::Context.new(2) M2R.zmq_context = ctx assert_equal ctx, M2R.zmq_context end def test_only_1_context_created_when_race_condition threads = nil ZMQ::Context.expects(:new).returns(true).once Thread.exclusive do threads = 512.times.map do Thread.new do M2R.zmq_context end end end Timeout.timeout(5) do threads.each(&:join) end end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
m2r-2.0.2 | test/unit/m2r_test.rb |
m2r-2.0.1 | test/unit/m2r_test.rb |
m2r-2.0.0 | test/unit/m2r_test.rb |
m2r-1.0.0 | test/unit/m2r_test.rb |