diff options
Diffstat (limited to 'spec/ruby/core/io/read_spec.rb')
-rw-r--r-- | spec/ruby/core/io/read_spec.rb | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/spec/ruby/core/io/read_spec.rb b/spec/ruby/core/io/read_spec.rb index e005e14fdf..267d840cd3 100644 --- a/spec/ruby/core/io/read_spec.rb +++ b/spec/ruby/core/io/read_spec.rb @@ -36,11 +36,11 @@ describe "IO.read" do end it "raises an IOError if the options Hash specifies write mode" do - lambda { IO.read(@fname, 3, 0, {mode: "w"}) }.should raise_error(IOError) + -> { IO.read(@fname, 3, 0, {mode: "w"}) }.should raise_error(IOError) end it "raises an IOError if the options Hash specifies append only mode" do - lambda { IO.read(@fname, {mode: "a"}) }.should raise_error(IOError) + -> { IO.read(@fname, {mode: "a"}) }.should raise_error(IOError) end it "reads the file if the options Hash includes read mode" do @@ -79,20 +79,20 @@ describe "IO.read" do it "raises an Errno::ENOENT when the requested file does not exist" do rm_r @fname - lambda { IO.read @fname }.should raise_error(Errno::ENOENT) + -> { IO.read @fname }.should raise_error(Errno::ENOENT) end it "raises a TypeError when not passed a String type" do - lambda { IO.read nil }.should raise_error(TypeError) + -> { IO.read nil }.should raise_error(TypeError) end it "raises an ArgumentError when not passed a valid length" do - lambda { IO.read @fname, -1 }.should raise_error(ArgumentError) + -> { IO.read @fname, -1 }.should raise_error(ArgumentError) end it "raises an Errno::EINVAL when not passed a valid offset" do - lambda { IO.read @fname, 0, -1 }.should raise_error(Errno::EINVAL) - lambda { IO.read @fname, -1, -1 }.should raise_error(Errno::EINVAL) + -> { IO.read @fname, 0, -1 }.should raise_error(Errno::EINVAL) + -> { IO.read @fname, -1, -1 }.should raise_error(Errno::EINVAL) end it "uses the external encoding specified via the :external_encoding option" do @@ -137,7 +137,7 @@ describe "IO.read from a pipe" do platform_is_not :windows do it "raises Errno::ESPIPE if passed an offset" do - lambda { + -> { IO.read("|sh -c 'echo hello'", 1, 1) }.should raise_error(Errno::ESPIPE) end @@ -148,7 +148,7 @@ quarantine! do # The process tried to write to a nonexistent pipe. # TODO: It should raise Errno::ESPIPE on Windows as well # once https://bugs.ruby-lang.org/issues/12230 is fixed. it "raises Errno::EINVAL if passed an offset" do - lambda { + -> { IO.read("|cmd.exe /C echo hello", 1, 1) }.should raise_error(Errno::EINVAL) end @@ -301,7 +301,7 @@ describe "IO#read" do end it "raises IOError on closed stream" do - lambda { IOSpecs.closed_io.read }.should raise_error(IOError) + -> { IOSpecs.closed_io.read }.should raise_error(IOError) end |