Skip to content

Commit e8b1193

Browse files
committed
✅ Add wait_for_response_count test helper
1 parent 1344a09 commit e8b1193

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

test/net/imap/test_imap.rb

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1423,4 +1423,16 @@ def create_tcp_server
14231423
def server_addr
14241424
Addrinfo.tcp("localhost", 0).ip_address
14251425
end
1426+
1427+
def wait_for_response_count(imap, type:, count:,
1428+
timeout: 0.5, interval: 0.001)
1429+
deadline = Time.now + timeout
1430+
loop do
1431+
current_count = imap.responses(type, &:size)
1432+
break :count if count <= current_count
1433+
break :deadline if deadline < Time.now
1434+
sleep interval
1435+
end
1436+
end
1437+
14261438
end

0 commit comments

Comments
 (0)