spec/async/io/stream_spec.rb in async-io-1.9.4 vs spec/async/io/stream_spec.rb in async-io-1.10.0
- old
+ new
@@ -95,6 +95,31 @@
stream.flush
expect(io.string).to be == "Hello World\n"
end
end
+
+ describe '#eof' do
+ it "should terminate stream" do
+ expect do
+ stream.eof!
+ end.to raise_error(EOFError)
+
+ expect(stream).to be_eof
+ end
+ end
+
+ describe '#close' do
+ it 'can be closed even if underlying io is closed' do
+ io.close
+
+ expect(stream.io).to be_closed
+
+ # Put some data in the write buffer
+ stream.write "."
+
+ expect do
+ stream.close
+ end.to_not raise_error
+ end
+ end
end