Skip to content

Commit

Permalink
Remove race condition from test.
Browse files Browse the repository at this point in the history
  • Loading branch information
ioquatix committed Sep 5, 2024
1 parent de35b62 commit b1c6cf6
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions fixtures/async/http/body/a_writable_body.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit b1c6cf6

Please sign in to comment.