From b1c6cf6922cdbed3cd9df9a9f2f71258734033c5 Mon Sep 17 00:00:00 2001 From: Samuel Williams Date: Fri, 6 Sep 2024 10:03:21 +1200 Subject: [PATCH] Remove race condition from test. --- fixtures/async/http/body/a_writable_body.rb | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/fixtures/async/http/body/a_writable_body.rb b/fixtures/async/http/body/a_writable_body.rb index eca1c5d9..24c18c38 100644 --- a/fixtures/async/http/body/a_writable_body.rb +++ b/fixtures/async/http/body/a_writable_body.rb @@ -86,21 +86,16 @@ module Body }.to raise_exception(RuntimeError, message: be =~ /big/) end - it "will stop after finishing" do - output_task = reactor.async do - body.each do |chunk| - expect(chunk).to be == "Hello World!" - end - end - + it "can consume chunks" do body.write("Hello World!") body.close expect(body).not.to be(:empty?) - ::Async::Task.current.yield + body.each do |chunk| + expect(chunk).to be == "Hello World!" + end - expect(output_task).to be(:finished?) expect(body).to be(:empty?) end end