spec/pushpull_spec.rb in ffi-rzmq-2.0.1 vs spec/pushpull_spec.rb in ffi-rzmq-2.0.4
- old
+ new
@@ -33,25 +33,25 @@
it "should receive an exact copy of the sent message using Message objects directly on one pull socket" do
@push.send_string string
received = ''
rc = @pull.recv_string received
assert_ok(rc)
- received.should == string
+ expect(received).to eq(string)
end
it "should receive an exact string copy of the message sent when receiving in non-blocking mode and using Message objects directly" do
sent_message = Message.new string
received_message = Message.new
poll_it_for_read(@pull) do
rc = @push.sendmsg sent_message
- rc.should == string.size
+ expect(rc).to eq(string.size)
end
rc = @pull.recvmsg received_message, ZMQ::DONTWAIT
- rc.should == string.size
- received_message.copy_out_string.should == string
+ expect(rc).to eq(string.size)
+ expect(received_message.copy_out_string).to eq(string)
end
it "should receive a single message for each message sent on each socket listening, when an equal number of sockets pulls messages and where each socket is unique per thread" do
@@ -72,22 +72,22 @@
sockets.each do |socket|
thr = Thread.new do
buffer = ''
rc = socket.recv_string buffer
- rc.should == buffer.size
+ expect(rc).to eq(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
+ expect(received.find_all {|r| r == string}.length).to eq(count)
end
it "should receive a single message for each message sent when using a single shared socket protected by a mutex" do
received = []
threads = []
@@ -97,19 +97,19 @@
count.times do |i|
threads << Thread.new do
buffer = ''
rc = 0
mutex.synchronize { rc = @pull.recv_string buffer }
- rc.should == buffer.size
+ expect(rc).to eq(buffer.size)
mutex.synchronize { received << buffer }
end
end
count.times { @push.send_string(string) }
threads.each {|t| t.join}
- received.find_all {|r| r == string}.length.should == count
+ expect(received.find_all {|r| r == string}.length).to eq(count)
end
end # @context ping-pong
end # describe
end # module ZMQ