test ruby client: wait until client flushes the output

It resolves random test failure.