spec/async/io/stream_spec.rb in async-io-1.8.0 vs spec/async/io/stream_spec.rb in async-io-1.8.1
- old
+ new
@@ -47,9 +47,20 @@
expect(stream.read(20)).to be == "o World"
expect(stream).to be_eof
end
end
+ describe '#read_until' do
+ it "can read a line" do
+ io.write("hello\nworld\n")
+ io.seek(0)
+
+ expect(stream.read_until("\n")).to be == 'hello'
+ expect(stream.read_until("\n")).to be == 'world'
+ expect(stream.read_until("\n")).to be_nil
+ end
+ end
+
describe '#flush' do
it "should not call write if write buffer is empty" do
expect(io).to_not receive(:write)
stream.flush