spec/pushpull_spec.rb in ffi-rzmq-1.0.3 vs spec/pushpull_spec.rb in ffi-rzmq-2.0.0

- old
+ new

@@ -42,15 +42,15 @@ sent_message = Message.new string received_message = Message.new poll_it_for_read(@pull) do rc = @push.sendmsg sent_message - LibZMQ.version2? ? rc.should == 0 : rc.should == string.size + rc.should == string.size end - rc = @pull.recvmsg received_message, ZMQ::NonBlocking - LibZMQ.version2? ? rc.should == 0 : rc.should == string.size + rc = @pull.recvmsg received_message, ZMQ::DONTWAIT + rc.should == string.size received_message.copy_out_string.should == string end @@ -69,19 +69,20 @@ sockets << socket end sockets << @pull sockets.each do |socket| - threads << Thread.new do + thr = Thread.new do buffer = '' rc = socket.recv_string buffer - version2? ? (rc.should == 0) : (rc.should == buffer.size) + rc.should == buffer.size mutex.synchronize { received << buffer } socket.close end + threads << thr end - + count.times { @push.send_string(string) } threads.each {|t| t.join} received.find_all {|r| r == string}.length.should == count @@ -96,10 +97,10 @@ count.times do |i| threads << Thread.new do buffer = '' rc = 0 mutex.synchronize { rc = @pull.recv_string buffer } - version2? ? (rc.should == 0) : (rc.should == buffer.size) + rc.should == buffer.size mutex.synchronize { received << buffer } end end count.times { @push.send_string(string) }