summaryrefslogtreecommitdiff
path: root/spec/ruby/core/io/sysread_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/ruby/core/io/sysread_spec.rb')
-rw-r--r--spec/ruby/core/io/sysread_spec.rb18
1 files changed, 8 insertions, 10 deletions
diff --git a/spec/ruby/core/io/sysread_spec.rb b/spec/ruby/core/io/sysread_spec.rb
index 8851214283..2d58db2250 100644
--- a/spec/ruby/core/io/sysread_spec.rb
+++ b/spec/ruby/core/io/sysread_spec.rb
@@ -52,7 +52,7 @@ describe "IO#sysread on a file" do
it "raises an error when called after buffered reads" do
@file.readline
- -> { @file.sysread(5) }.should raise_error(IOError)
+ -> { @file.sysread(5) }.should.raise(IOError)
end
it "reads normally even when called immediately after a buffered IO#read" do
@@ -63,13 +63,13 @@ describe "IO#sysread on a file" do
it "does not raise error if called after IO#read followed by IO#write" do
@file.read(5)
@file.write("abcde")
- -> { @file.sysread(5) }.should_not raise_error(IOError)
+ -> { @file.sysread(5) }.should_not.raise(IOError)
end
it "does not raise error if called after IO#read followed by IO#syswrite" do
@file.read(5)
@file.syswrite("abcde")
- -> { @file.sysread(5) }.should_not raise_error(IOError)
+ -> { @file.sysread(5) }.should_not.raise(IOError)
end
it "reads updated content after the flushed buffered IO#write" do
@@ -82,7 +82,7 @@ describe "IO#sysread on a file" do
end
it "raises IOError on closed stream" do
- -> { IOSpecs.closed_io.sysread(5) }.should raise_error(IOError)
+ -> { IOSpecs.closed_io.sysread(5) }.should.raise(IOError)
end
it "immediately returns an empty string if the length argument is 0" do
@@ -104,8 +104,8 @@ describe "IO#sysread on a file" do
it "discards the existing buffer content upon error" do
buffer = +"existing content"
@file.seek(0, :END)
- -> { @file.sysread(1, buffer) }.should raise_error(EOFError)
- buffer.should be_empty
+ -> { @file.sysread(1, buffer) }.should.raise(EOFError)
+ buffer.should.empty?
end
it "preserves the encoding of the given buffer" do
@@ -131,9 +131,7 @@ describe "IO#sysread" do
@read.sysread(3).should == "ab"
end
- guard_not -> { platform_is :windows and ruby_version_is ""..."3.2" } do # https://bugs.ruby-lang.org/issues/18880
- it "raises ArgumentError when length is less than 0" do
- -> { @read.sysread(-1) }.should raise_error(ArgumentError)
- end
+ it "raises ArgumentError when length is less than 0" do
+ -> { @read.sysread(-1) }.should.raise(ArgumentError)
end
end