Skip to content

Commit c69227f

Browse files
committed
Add spec for StringIO#read_nonblock with EOF and exception: false
1 parent fc400a3 commit c69227f

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

spec/ruby/library/stringio/read_nonblock_spec.rb

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,17 @@
2626
stringio.read_nonblock(3, exception: false).should == 'foo'
2727
end
2828

29+
context "when exception option is set to false" do
30+
context "when the end is reached" do
31+
it "returns nil" do
32+
stringio = StringIO.new('')
33+
stringio << "hello"
34+
stringio.rewind
35+
36+
stringio.read_nonblock(5).should == "hello"
37+
stringio.read_nonblock(5, exception: false).should be_nil
38+
end
39+
end
40+
end
41+
2942
end

0 commit comments

Comments
 (0)