spec/async/io/stream_spec.rb in async-io-1.27.3 vs spec/async/io/stream_spec.rb in async-io-1.27.4

- old
+ new

@@ -28,11 +28,11 @@ RSpec.describe Async::IO::Stream do # This constant is part of the public interface, but was renamed to `Async::IO::BLOCK_SIZE`. describe "::BLOCK_SIZE" do it "should exist and be reasonable" do - expect(Async::IO::Stream::BLOCK_SIZE).to be_between(1024, 1024*32) + expect(Async::IO::Stream::BLOCK_SIZE).to be_between(1024, 1024*128) end end context "socket I/O" do let(:sockets) do @@ -239,11 +239,13 @@ end end describe '#read_partial' do before(:each) do - io.write("Hello World!" * 1024) + string = "Hello World!" + + io.write(string * (1 + (Async::IO::BLOCK_SIZE / string.bytesize))) io.seek(0) end it "should avoid calling read" do expect(subject.io).to receive(:read_nonblock).and_call_original.once @@ -258,10 +260,10 @@ end.to limit_allocations.of(String, count: 2, size: 4*1024+1) end it "allocates exact number of bytes being read" do expect do - subject.read_partial(16*1024) + subject.read_partial(subject.block_size * 2) end.to limit_allocations.of(String, count: 1, size: 0) end it "allocates expected amount of bytes" do buffer = nil