summaryrefslogtreecommitdiff
path: root/spec/ruby/library/stringio
diff options
context:
space:
mode:
Diffstat (limited to 'spec/ruby/library/stringio')
-rw-r--r--spec/ruby/library/stringio/append_spec.rb4
-rw-r--r--spec/ruby/library/stringio/close_read_spec.rb4
-rw-r--r--spec/ruby/library/stringio/close_spec.rb6
-rw-r--r--spec/ruby/library/stringio/close_write_spec.rb4
-rw-r--r--spec/ruby/library/stringio/fcntl_spec.rb2
-rw-r--r--spec/ruby/library/stringio/gets_spec.rb4
-rw-r--r--spec/ruby/library/stringio/initialize_spec.rb8
-rw-r--r--spec/ruby/library/stringio/open_spec.rb8
-rw-r--r--spec/ruby/library/stringio/path_spec.rb2
-rw-r--r--spec/ruby/library/stringio/pos_spec.rb2
-rw-r--r--spec/ruby/library/stringio/print_spec.rb4
-rw-r--r--spec/ruby/library/stringio/printf_spec.rb6
-rw-r--r--spec/ruby/library/stringio/putc_spec.rb6
-rw-r--r--spec/ruby/library/stringio/puts_spec.rb4
-rw-r--r--spec/ruby/library/stringio/readline_spec.rb6
-rw-r--r--spec/ruby/library/stringio/readlines_spec.rb4
-rw-r--r--spec/ruby/library/stringio/readpartial_spec.rb10
-rw-r--r--spec/ruby/library/stringio/reopen_spec.rb22
-rw-r--r--spec/ruby/library/stringio/seek_spec.rb14
-rw-r--r--spec/ruby/library/stringio/shared/codepoints.rb6
-rw-r--r--spec/ruby/library/stringio/shared/each.rb4
-rw-r--r--spec/ruby/library/stringio/shared/each_byte.rb4
-rw-r--r--spec/ruby/library/stringio/shared/each_char.rb4
-rw-r--r--spec/ruby/library/stringio/shared/getc.rb4
-rw-r--r--spec/ruby/library/stringio/shared/read.rb12
-rw-r--r--spec/ruby/library/stringio/shared/readchar.rb6
-rw-r--r--spec/ruby/library/stringio/shared/sysread.rb2
-rw-r--r--spec/ruby/library/stringio/shared/write.rb4
-rw-r--r--spec/ruby/library/stringio/string_spec.rb2
-rw-r--r--spec/ruby/library/stringio/sysread_spec.rb2
-rw-r--r--spec/ruby/library/stringio/truncate_spec.rb10
-rw-r--r--spec/ruby/library/stringio/ungetc_spec.rb6
32 files changed, 93 insertions, 93 deletions
diff --git a/spec/ruby/library/stringio/append_spec.rb b/spec/ruby/library/stringio/append_spec.rb
index 08500bc520..a8bc6aabdb 100644
--- a/spec/ruby/library/stringio/append_spec.rb
+++ b/spec/ruby/library/stringio/append_spec.rb
@@ -55,11 +55,11 @@ end
describe "StringIO#<< when self is not writable" do
it "raises an IOError" do
io = StringIO.new("test", "r")
- lambda { io << "test" }.should raise_error(IOError)
+ -> { io << "test" }.should raise_error(IOError)
io = StringIO.new("test")
io.close_write
- lambda { io << "test" }.should raise_error(IOError)
+ -> { io << "test" }.should raise_error(IOError)
end
end
diff --git a/spec/ruby/library/stringio/close_read_spec.rb b/spec/ruby/library/stringio/close_read_spec.rb
index 05d6c9f7d2..80bd547e85 100644
--- a/spec/ruby/library/stringio/close_read_spec.rb
+++ b/spec/ruby/library/stringio/close_read_spec.rb
@@ -12,7 +12,7 @@ describe "StringIO#close_read" do
it "prevents further reading" do
@io.close_read
- lambda { @io.read(1) }.should raise_error(IOError)
+ -> { @io.read(1) }.should raise_error(IOError)
end
it "allows further writing" do
@@ -22,7 +22,7 @@ describe "StringIO#close_read" do
it "raises an IOError when in write-only mode" do
io = StringIO.new("example", "w")
- lambda { io.close_read }.should raise_error(IOError)
+ -> { io.close_read }.should raise_error(IOError)
io = StringIO.new("example")
io.close_read
diff --git a/spec/ruby/library/stringio/close_spec.rb b/spec/ruby/library/stringio/close_spec.rb
index a5a931aff1..520a8de782 100644
--- a/spec/ruby/library/stringio/close_spec.rb
+++ b/spec/ruby/library/stringio/close_spec.rb
@@ -12,12 +12,12 @@ describe "StringIO#close" do
it "prevents further reading and/or writing" do
@io.close
- lambda { @io.read(1) }.should raise_error(IOError)
- lambda { @io.write('x') }.should raise_error(IOError)
+ -> { @io.read(1) }.should raise_error(IOError)
+ -> { @io.write('x') }.should raise_error(IOError)
end
it "does not raise anything when self was already closed" do
@io.close
- lambda { @io.close }.should_not raise_error(IOError)
+ -> { @io.close }.should_not raise_error(IOError)
end
end
diff --git a/spec/ruby/library/stringio/close_write_spec.rb b/spec/ruby/library/stringio/close_write_spec.rb
index 8a7ac12581..1a4cfa113e 100644
--- a/spec/ruby/library/stringio/close_write_spec.rb
+++ b/spec/ruby/library/stringio/close_write_spec.rb
@@ -12,7 +12,7 @@ describe "StringIO#close_write" do
it "prevents further writing" do
@io.close_write
- lambda { @io.write('x') }.should raise_error(IOError)
+ -> { @io.write('x') }.should raise_error(IOError)
end
it "allows further reading" do
@@ -22,7 +22,7 @@ describe "StringIO#close_write" do
it "raises an IOError when in read-only mode" do
io = StringIO.new("example", "r")
- lambda { io.close_write }.should raise_error(IOError)
+ -> { io.close_write }.should raise_error(IOError)
io = StringIO.new("example")
io.close_write
diff --git a/spec/ruby/library/stringio/fcntl_spec.rb b/spec/ruby/library/stringio/fcntl_spec.rb
index e4133c0d06..a78004d868 100644
--- a/spec/ruby/library/stringio/fcntl_spec.rb
+++ b/spec/ruby/library/stringio/fcntl_spec.rb
@@ -3,6 +3,6 @@ require_relative 'fixtures/classes'
describe "StringIO#fcntl" do
it "raises a NotImplementedError" do
- lambda { StringIO.new("boom").fcntl }.should raise_error(NotImplementedError)
+ -> { StringIO.new("boom").fcntl }.should raise_error(NotImplementedError)
end
end
diff --git a/spec/ruby/library/stringio/gets_spec.rb b/spec/ruby/library/stringio/gets_spec.rb
index d682b2784f..69880672a3 100644
--- a/spec/ruby/library/stringio/gets_spec.rb
+++ b/spec/ruby/library/stringio/gets_spec.rb
@@ -229,11 +229,11 @@ end
describe "StringIO#gets when in write-only mode" do
it "raises an IOError" do
io = StringIO.new("xyz", "w")
- lambda { io.gets }.should raise_error(IOError)
+ -> { io.gets }.should raise_error(IOError)
io = StringIO.new("xyz")
io.close_read
- lambda { io.gets }.should raise_error(IOError)
+ -> { io.gets }.should raise_error(IOError)
end
end
diff --git a/spec/ruby/library/stringio/initialize_spec.rb b/spec/ruby/library/stringio/initialize_spec.rb
index b503ed2206..cc4f4c9254 100644
--- a/spec/ruby/library/stringio/initialize_spec.rb
+++ b/spec/ruby/library/stringio/initialize_spec.rb
@@ -112,7 +112,7 @@ describe "StringIO#initialize when passed [Object, mode]" do
it "raises a #{frozen_error_class} when passed a frozen String in truncate mode as StringIO backend" do
io = StringIO.allocate
- lambda { io.send(:initialize, "example".freeze, IO::TRUNC) }.should raise_error(frozen_error_class)
+ -> { io.send(:initialize, "example".freeze, IO::TRUNC) }.should raise_error(frozen_error_class)
end
it "tries to convert the passed mode to a String using #to_str" do
@@ -126,9 +126,9 @@ describe "StringIO#initialize when passed [Object, mode]" do
it "raises an Errno::EACCES error when passed a frozen string with a write-mode" do
(str = "example").freeze
- lambda { @io.send(:initialize, str, "r+") }.should raise_error(Errno::EACCES)
- lambda { @io.send(:initialize, str, "w") }.should raise_error(Errno::EACCES)
- lambda { @io.send(:initialize, str, "a") }.should raise_error(Errno::EACCES)
+ -> { @io.send(:initialize, str, "r+") }.should raise_error(Errno::EACCES)
+ -> { @io.send(:initialize, str, "w") }.should raise_error(Errno::EACCES)
+ -> { @io.send(:initialize, str, "a") }.should raise_error(Errno::EACCES)
end
end
diff --git a/spec/ruby/library/stringio/open_spec.rb b/spec/ruby/library/stringio/open_spec.rb
index f8f3feabee..adb784c890 100644
--- a/spec/ruby/library/stringio/open_spec.rb
+++ b/spec/ruby/library/stringio/open_spec.rb
@@ -135,7 +135,7 @@ describe "StringIO.open when passed [Object, mode]" do
end
it "raises a #{frozen_error_class} when passed a frozen String in truncate mode as StringIO backend" do
- lambda { StringIO.open("example".freeze, IO::TRUNC) }.should raise_error(frozen_error_class)
+ -> { StringIO.open("example".freeze, IO::TRUNC) }.should raise_error(frozen_error_class)
end
it "tries to convert the passed mode to a String using #to_str" do
@@ -149,9 +149,9 @@ describe "StringIO.open when passed [Object, mode]" do
it "raises an Errno::EACCES error when passed a frozen string with a write-mode" do
(str = "example").freeze
- lambda { StringIO.open(str, "r+") }.should raise_error(Errno::EACCES)
- lambda { StringIO.open(str, "w") }.should raise_error(Errno::EACCES)
- lambda { StringIO.open(str, "a") }.should raise_error(Errno::EACCES)
+ -> { StringIO.open(str, "r+") }.should raise_error(Errno::EACCES)
+ -> { StringIO.open(str, "w") }.should raise_error(Errno::EACCES)
+ -> { StringIO.open(str, "a") }.should raise_error(Errno::EACCES)
end
end
diff --git a/spec/ruby/library/stringio/path_spec.rb b/spec/ruby/library/stringio/path_spec.rb
index 5439cf4b53..1184ca523f 100644
--- a/spec/ruby/library/stringio/path_spec.rb
+++ b/spec/ruby/library/stringio/path_spec.rb
@@ -3,6 +3,6 @@ require_relative 'fixtures/classes'
describe "StringIO#path" do
it "is not defined" do
- lambda { StringIO.new("path").path }.should raise_error(NoMethodError)
+ -> { StringIO.new("path").path }.should raise_error(NoMethodError)
end
end
diff --git a/spec/ruby/library/stringio/pos_spec.rb b/spec/ruby/library/stringio/pos_spec.rb
index 8d99294f31..81be5f01a5 100644
--- a/spec/ruby/library/stringio/pos_spec.rb
+++ b/spec/ruby/library/stringio/pos_spec.rb
@@ -17,7 +17,7 @@ describe "StringIO#pos=" do
end
it "raises an EINVAL if given a negative argument" do
- lambda { @io.pos = -10 }.should raise_error(Errno::EINVAL)
+ -> { @io.pos = -10 }.should raise_error(Errno::EINVAL)
end
it "updates the current byte offset after reaching EOF" do
diff --git a/spec/ruby/library/stringio/print_spec.rb b/spec/ruby/library/stringio/print_spec.rb
index 144a219509..d0f07d1e50 100644
--- a/spec/ruby/library/stringio/print_spec.rb
+++ b/spec/ruby/library/stringio/print_spec.rb
@@ -91,10 +91,10 @@ end
describe "StringIO#print when self is not writable" do
it "raises an IOError" do
io = StringIO.new("test", "r")
- lambda { io.print("test") }.should raise_error(IOError)
+ -> { io.print("test") }.should raise_error(IOError)
io = StringIO.new("test")
io.close_write
- lambda { io.print("test") }.should raise_error(IOError)
+ -> { io.print("test") }.should raise_error(IOError)
end
end
diff --git a/spec/ruby/library/stringio/printf_spec.rb b/spec/ruby/library/stringio/printf_spec.rb
index 3978896621..f88ca1eb20 100644
--- a/spec/ruby/library/stringio/printf_spec.rb
+++ b/spec/ruby/library/stringio/printf_spec.rb
@@ -31,7 +31,7 @@ describe "StringIO#printf" do
end
describe "formatting" do
- it_behaves_like :kernel_sprintf, -> (format, *args) {
+ it_behaves_like :kernel_sprintf, -> format, *args {
io = StringIO.new
io.printf(format, *args)
io.string
@@ -61,10 +61,10 @@ end
describe "StringIO#printf when self is not writable" do
it "raises an IOError" do
io = StringIO.new("test", "r")
- lambda { io.printf("test") }.should raise_error(IOError)
+ -> { io.printf("test") }.should raise_error(IOError)
io = StringIO.new("test")
io.close_write
- lambda { io.printf("test") }.should raise_error(IOError)
+ -> { io.printf("test") }.should raise_error(IOError)
end
end
diff --git a/spec/ruby/library/stringio/putc_spec.rb b/spec/ruby/library/stringio/putc_spec.rb
index eae5481d6e..223b3523e5 100644
--- a/spec/ruby/library/stringio/putc_spec.rb
+++ b/spec/ruby/library/stringio/putc_spec.rb
@@ -64,7 +64,7 @@ describe "StringIO#putc when passed [Object]" do
end
it "raises a TypeError when the passed argument can't be coerced to Integer" do
- lambda { @io.putc(Object.new) }.should raise_error(TypeError)
+ -> { @io.putc(Object.new) }.should raise_error(TypeError)
end
end
@@ -79,10 +79,10 @@ end
describe "StringIO#putc when self is not writable" do
it "raises an IOError" do
io = StringIO.new("test", "r")
- lambda { io.putc(?a) }.should raise_error(IOError)
+ -> { io.putc(?a) }.should raise_error(IOError)
io = StringIO.new("test")
io.close_write
- lambda { io.putc("t") }.should raise_error(IOError)
+ -> { io.putc("t") }.should raise_error(IOError)
end
end
diff --git a/spec/ruby/library/stringio/puts_spec.rb b/spec/ruby/library/stringio/puts_spec.rb
index 152bfb13f8..2d3db25c5f 100644
--- a/spec/ruby/library/stringio/puts_spec.rb
+++ b/spec/ruby/library/stringio/puts_spec.rb
@@ -148,11 +148,11 @@ end
describe "StringIO#puts when self is not writable" do
it "raises an IOError" do
io = StringIO.new("test", "r")
- lambda { io.puts }.should raise_error(IOError)
+ -> { io.puts }.should raise_error(IOError)
io = StringIO.new("test")
io.close_write
- lambda { io.puts }.should raise_error(IOError)
+ -> { io.puts }.should raise_error(IOError)
end
end
diff --git a/spec/ruby/library/stringio/readline_spec.rb b/spec/ruby/library/stringio/readline_spec.rb
index dc396f61a9..9af633472e 100644
--- a/spec/ruby/library/stringio/readline_spec.rb
+++ b/spec/ruby/library/stringio/readline_spec.rb
@@ -106,18 +106,18 @@ describe "StringIO#readline when passed no argument" do
it "raises an IOError if self is at the end" do
@io.pos = 40
- lambda { @io.readline }.should raise_error(IOError)
+ -> { @io.readline }.should raise_error(IOError)
end
end
describe "StringIO#readline when in write-only mode" do
it "raises an IOError" do
io = StringIO.new("xyz", "w")
- lambda { io.readline }.should raise_error(IOError)
+ -> { io.readline }.should raise_error(IOError)
io = StringIO.new("xyz")
io.close_read
- lambda { io.readline }.should raise_error(IOError)
+ -> { io.readline }.should raise_error(IOError)
end
end
diff --git a/spec/ruby/library/stringio/readlines_spec.rb b/spec/ruby/library/stringio/readlines_spec.rb
index 840470c09c..7f9f9f5846 100644
--- a/spec/ruby/library/stringio/readlines_spec.rb
+++ b/spec/ruby/library/stringio/readlines_spec.rb
@@ -83,11 +83,11 @@ end
describe "StringIO#readlines when in write-only mode" do
it "raises an IOError" do
io = StringIO.new("xyz", "w")
- lambda { io.readlines }.should raise_error(IOError)
+ -> { io.readlines }.should raise_error(IOError)
io = StringIO.new("xyz")
io.close_read
- lambda { io.readlines }.should raise_error(IOError)
+ -> { io.readlines }.should raise_error(IOError)
end
end
diff --git a/spec/ruby/library/stringio/readpartial_spec.rb b/spec/ruby/library/stringio/readpartial_spec.rb
index 54e2f47004..2601fe8c42 100644
--- a/spec/ruby/library/stringio/readpartial_spec.rb
+++ b/spec/ruby/library/stringio/readpartial_spec.rb
@@ -12,7 +12,7 @@ describe "StringIO#readpartial" do
it "raises IOError on closed stream" do
@string.close
- lambda { @string.readpartial(10) }.should raise_error(IOError)
+ -> { @string.readpartial(10) }.should raise_error(IOError)
end
it "reads at most the specified number of bytes" do
@@ -55,23 +55,23 @@ describe "StringIO#readpartial" do
it "raises EOFError on EOF" do
@string.readpartial(18).should == 'Stop, look, listen'
- lambda { @string.readpartial(10) }.should raise_error(EOFError)
+ -> { @string.readpartial(10) }.should raise_error(EOFError)
end
it "discards the existing buffer content upon error" do
buffer = 'hello'
@string.readpartial(100)
- lambda { @string.readpartial(1, buffer) }.should raise_error(EOFError)
+ -> { @string.readpartial(1, buffer) }.should raise_error(EOFError)
buffer.should be_empty
end
it "raises IOError if the stream is closed" do
@string.close
- lambda { @string.readpartial(1) }.should raise_error(IOError)
+ -> { @string.readpartial(1) }.should raise_error(IOError)
end
it "raises ArgumentError if the negative argument is provided" do
- lambda { @string.readpartial(-1) }.should raise_error(ArgumentError)
+ -> { @string.readpartial(-1) }.should raise_error(ArgumentError)
end
it "immediately returns an empty string if the length argument is 0" do
diff --git a/spec/ruby/library/stringio/reopen_spec.rb b/spec/ruby/library/stringio/reopen_spec.rb
index 51aff43ba2..6b5bdb57a1 100644
--- a/spec/ruby/library/stringio/reopen_spec.rb
+++ b/spec/ruby/library/stringio/reopen_spec.rb
@@ -40,16 +40,16 @@ describe "StringIO#reopen when passed [Object, Integer]" do
end
it "raises a TypeError when the passed Object can't be converted to a String" do
- lambda { @io.reopen(Object.new, IO::RDWR) }.should raise_error(TypeError)
+ -> { @io.reopen(Object.new, IO::RDWR) }.should raise_error(TypeError)
end
it "raises an Errno::EACCES when trying to reopen self with a frozen String in write-mode" do
- lambda { @io.reopen("burn".freeze, IO::WRONLY) }.should raise_error(Errno::EACCES)
- lambda { @io.reopen("burn".freeze, IO::WRONLY | IO::APPEND) }.should raise_error(Errno::EACCES)
+ -> { @io.reopen("burn".freeze, IO::WRONLY) }.should raise_error(Errno::EACCES)
+ -> { @io.reopen("burn".freeze, IO::WRONLY | IO::APPEND) }.should raise_error(Errno::EACCES)
end
it "raises a #{frozen_error_class} when trying to reopen self with a frozen String in truncate-mode" do
- lambda { @io.reopen("burn".freeze, IO::RDONLY | IO::TRUNC) }.should raise_error(frozen_error_class)
+ -> { @io.reopen("burn".freeze, IO::RDONLY | IO::TRUNC) }.should raise_error(frozen_error_class)
end
it "does not raise IOError when passed a frozen String in read-mode" do
@@ -107,7 +107,7 @@ describe "StringIO#reopen when passed [Object, Object]" do
end
it "raises a TypeError when the passed Object can't be converted to a String using #to_str" do
- lambda { @io.reopen(Object.new, "r") }.should raise_error(TypeError)
+ -> { @io.reopen(Object.new, "r") }.should raise_error(TypeError)
end
it "resets self's position to 0" do
@@ -132,10 +132,10 @@ describe "StringIO#reopen when passed [Object, Object]" do
end
it "raises an Errno::EACCES error when trying to reopen self with a frozen String in write-mode" do
- lambda { @io.reopen("burn".freeze, 'w') }.should raise_error(Errno::EACCES)
- lambda { @io.reopen("burn".freeze, 'w+') }.should raise_error(Errno::EACCES)
- lambda { @io.reopen("burn".freeze, 'a') }.should raise_error(Errno::EACCES)
- lambda { @io.reopen("burn".freeze, "r+") }.should raise_error(Errno::EACCES)
+ -> { @io.reopen("burn".freeze, 'w') }.should raise_error(Errno::EACCES)
+ -> { @io.reopen("burn".freeze, 'w+') }.should raise_error(Errno::EACCES)
+ -> { @io.reopen("burn".freeze, 'a') }.should raise_error(Errno::EACCES)
+ -> { @io.reopen("burn".freeze, "r+") }.should raise_error(Errno::EACCES)
end
it "does not raise IOError if a frozen string is passed in read mode" do
@@ -185,13 +185,13 @@ describe "StringIO#reopen when passed [Object]" do
end
it "raises a TypeError when passed an Object that can't be converted to a StringIO" do
- lambda { @io.reopen(Object.new) }.should raise_error(TypeError)
+ -> { @io.reopen(Object.new) }.should raise_error(TypeError)
end
it "does not try to convert the passed Object to a String using #to_str" do
obj = mock("not to_str")
obj.should_not_receive(:to_str)
- lambda { @io.reopen(obj) }.should raise_error(TypeError)
+ -> { @io.reopen(obj) }.should raise_error(TypeError)
end
it "tries to convert the passed Object to a StringIO using #to_strio" do
diff --git a/spec/ruby/library/stringio/seek_spec.rb b/spec/ruby/library/stringio/seek_spec.rb
index b963b77eef..253b5027a9 100644
--- a/spec/ruby/library/stringio/seek_spec.rb
+++ b/spec/ruby/library/stringio/seek_spec.rb
@@ -33,14 +33,14 @@ describe "StringIO#seek" do
end
it "raises an Errno::EINVAL error on negative amounts when whence is IO::SEEK_SET" do
- lambda { @io.seek(-5, IO::SEEK_SET) }.should raise_error(Errno::EINVAL)
+ -> { @io.seek(-5, IO::SEEK_SET) }.should raise_error(Errno::EINVAL)
end
it "raises an Errno::EINVAL error on incorrect whence argument" do
- lambda { @io.seek(0, 3) }.should raise_error(Errno::EINVAL)
- lambda { @io.seek(0, -1) }.should raise_error(Errno::EINVAL)
- lambda { @io.seek(0, 2**16) }.should raise_error(Errno::EINVAL)
- lambda { @io.seek(0, -2**16) }.should raise_error(Errno::EINVAL)
+ -> { @io.seek(0, 3) }.should raise_error(Errno::EINVAL)
+ -> { @io.seek(0, -1) }.should raise_error(Errno::EINVAL)
+ -> { @io.seek(0, 2**16) }.should raise_error(Errno::EINVAL)
+ -> { @io.seek(0, -2**16) }.should raise_error(Errno::EINVAL)
end
it "tries to convert the passed Object to a String using #to_int" do
@@ -51,7 +51,7 @@ describe "StringIO#seek" do
end
it "raises a TypeError when the passed Object can't be converted to an Integer" do
- lambda { @io.seek(Object.new) }.should raise_error(TypeError)
+ -> { @io.seek(Object.new) }.should raise_error(TypeError)
end
end
@@ -62,6 +62,6 @@ describe "StringIO#seek when self is closed" do
end
it "raises an IOError" do
- lambda { @io.seek(5) }.should raise_error(IOError)
+ -> { @io.seek(5) }.should raise_error(IOError)
end
end
diff --git a/spec/ruby/library/stringio/shared/codepoints.rb b/spec/ruby/library/stringio/shared/codepoints.rb
index c8ca03329f..9d84aa4919 100644
--- a/spec/ruby/library/stringio/shared/codepoints.rb
+++ b/spec/ruby/library/stringio/shared/codepoints.rb
@@ -20,15 +20,15 @@ describe :stringio_codepoints, shared: true do
it "raises an error if reading invalid sequence" do
@io.pos = 1 # inside of a multibyte sequence
- lambda { @enum.first }.should raise_error(ArgumentError)
+ -> { @enum.first }.should raise_error(ArgumentError)
end
it "raises an IOError if not readable" do
@io.close_read
- lambda { @enum.to_a }.should raise_error(IOError)
+ -> { @enum.to_a }.should raise_error(IOError)
io = StringIO.new("xyz", "w")
- lambda { io.send(@method).to_a }.should raise_error(IOError)
+ -> { io.send(@method).to_a }.should raise_error(IOError)
end
diff --git a/spec/ruby/library/stringio/shared/each.rb b/spec/ruby/library/stringio/shared/each.rb
index 55ed27c1c7..c08d40344c 100644
--- a/spec/ruby/library/stringio/shared/each.rb
+++ b/spec/ruby/library/stringio/shared/each.rb
@@ -96,11 +96,11 @@ end
describe :stringio_each_not_readable, shared: true do
it "raises an IOError" do
io = StringIO.new("a b c d e", "w")
- lambda { io.send(@method) { |b| b } }.should raise_error(IOError)
+ -> { io.send(@method) { |b| b } }.should raise_error(IOError)
io = StringIO.new("a b c d e")
io.close_read
- lambda { io.send(@method) { |b| b } }.should raise_error(IOError)
+ -> { io.send(@method) { |b| b } }.should raise_error(IOError)
end
end
diff --git a/spec/ruby/library/stringio/shared/each_byte.rb b/spec/ruby/library/stringio/shared/each_byte.rb
index 1dc48ee437..56734ff99d 100644
--- a/spec/ruby/library/stringio/shared/each_byte.rb
+++ b/spec/ruby/library/stringio/shared/each_byte.rb
@@ -39,10 +39,10 @@ end
describe :stringio_each_byte_not_readable, shared: true do
it "raises an IOError" do
io = StringIO.new("xyz", "w")
- lambda { io.send(@method) { |b| b } }.should raise_error(IOError)
+ -> { io.send(@method) { |b| b } }.should raise_error(IOError)
io = StringIO.new("xyz")
io.close_read
- lambda { io.send(@method) { |b| b } }.should raise_error(IOError)
+ -> { io.send(@method) { |b| b } }.should raise_error(IOError)
end
end
diff --git a/spec/ruby/library/stringio/shared/each_char.rb b/spec/ruby/library/stringio/shared/each_char.rb
index 35efdcb749..bcdac53282 100644
--- a/spec/ruby/library/stringio/shared/each_char.rb
+++ b/spec/ruby/library/stringio/shared/each_char.rb
@@ -27,10 +27,10 @@ end
describe :stringio_each_char_not_readable, shared: true do
it "raises an IOError" do
io = StringIO.new("xyz", "w")
- lambda { io.send(@method) { |b| b } }.should raise_error(IOError)
+ -> { io.send(@method) { |b| b } }.should raise_error(IOError)
io = StringIO.new("xyz")
io.close_read
- lambda { io.send(@method) { |b| b } }.should raise_error(IOError)
+ -> { io.send(@method) { |b| b } }.should raise_error(IOError)
end
end
diff --git a/spec/ruby/library/stringio/shared/getc.rb b/spec/ruby/library/stringio/shared/getc.rb
index 3e064f9c1e..6318bcc30f 100644
--- a/spec/ruby/library/stringio/shared/getc.rb
+++ b/spec/ruby/library/stringio/shared/getc.rb
@@ -34,10 +34,10 @@ end
describe :stringio_getc_not_readable, shared: true do
it "raises an IOError" do
io = StringIO.new("xyz", "w")
- lambda { io.send(@method) }.should raise_error(IOError)
+ -> { io.send(@method) }.should raise_error(IOError)
io = StringIO.new("xyz")
io.close_read
- lambda { io.send(@method) }.should raise_error(IOError)
+ -> { io.send(@method) }.should raise_error(IOError)
end
end
diff --git a/spec/ruby/library/stringio/shared/read.rb b/spec/ruby/library/stringio/shared/read.rb
index 139c4fb02f..15ce58ae6a 100644
--- a/spec/ruby/library/stringio/shared/read.rb
+++ b/spec/ruby/library/stringio/shared/read.rb
@@ -24,11 +24,11 @@ describe :stringio_read, shared: true do
end
it "raises a TypeError when the passed buffer Object can't be converted to a String" do
- lambda { @io.send(@method, 7, Object.new) }.should raise_error(TypeError)
+ -> { @io.send(@method, 7, Object.new) }.should raise_error(TypeError)
end
it "raises a #{frozen_error_class} error when passed a frozen String as buffer" do
- lambda { @io.send(@method, 7, "".freeze) }.should raise_error(frozen_error_class)
+ -> { @io.send(@method, 7, "".freeze) }.should raise_error(frozen_error_class)
end
end
@@ -61,11 +61,11 @@ describe :stringio_read_length, shared: true do
end
it "raises a TypeError when the passed length can't be converted to an Integer" do
- lambda { @io.send(@method, Object.new) }.should raise_error(TypeError)
+ -> { @io.send(@method, Object.new) }.should raise_error(TypeError)
end
it "raises a TypeError when the passed length is negative" do
- lambda { @io.send(@method, -2) }.should raise_error(ArgumentError)
+ -> { @io.send(@method, -2) }.should raise_error(ArgumentError)
end
it "returns a binary String" do
@@ -112,10 +112,10 @@ end
describe :stringio_read_not_readable, shared: true do
it "raises an IOError" do
io = StringIO.new("test", "w")
- lambda { io.send(@method) }.should raise_error(IOError)
+ -> { io.send(@method) }.should raise_error(IOError)
io = StringIO.new("test")
io.close_read
- lambda { io.send(@method) }.should raise_error(IOError)
+ -> { io.send(@method) }.should raise_error(IOError)
end
end
diff --git a/spec/ruby/library/stringio/shared/readchar.rb b/spec/ruby/library/stringio/shared/readchar.rb
index 19194f0680..4248e75420 100644
--- a/spec/ruby/library/stringio/shared/readchar.rb
+++ b/spec/ruby/library/stringio/shared/readchar.rb
@@ -13,17 +13,17 @@ describe :stringio_readchar, shared: true do
it "raises an EOFError when self is at the end" do
@io.pos = 7
- lambda { @io.send(@method) }.should raise_error(EOFError)
+ -> { @io.send(@method) }.should raise_error(EOFError)
end
end
describe :stringio_readchar_not_readable, shared: true do
it "raises an IOError" do
io = StringIO.new("a b c d e", "w")
- lambda { io.send(@method) }.should raise_error(IOError)
+ -> { io.send(@method) }.should raise_error(IOError)
io = StringIO.new("a b c d e")
io.close_read
- lambda { io.send(@method) }.should raise_error(IOError)
+ -> { io.send(@method) }.should raise_error(IOError)
end
end
diff --git a/spec/ruby/library/stringio/shared/sysread.rb b/spec/ruby/library/stringio/shared/sysread.rb
index 9800b2339b..3376bd9907 100644
--- a/spec/ruby/library/stringio/shared/sysread.rb
+++ b/spec/ruby/library/stringio/shared/sysread.rb
@@ -10,6 +10,6 @@ describe :stringio_sysread_length, :shared => true do
it "raises an EOFError when passed length > 0 and no data remains" do
@io.read.should == "example"
- lambda { @io.sysread(1) }.should raise_error(EOFError)
+ -> { @io.sysread(1) }.should raise_error(EOFError)
end
end
diff --git a/spec/ruby/library/stringio/shared/write.rb b/spec/ruby/library/stringio/shared/write.rb
index bcb548bbd0..df4822cc16 100644
--- a/spec/ruby/library/stringio/shared/write.rb
+++ b/spec/ruby/library/stringio/shared/write.rb
@@ -59,11 +59,11 @@ end
describe :stringio_write_not_writable, shared: true do
it "raises an IOError" do
io = StringIO.new("test", "r")
- lambda { io.send(@method, "test") }.should raise_error(IOError)
+ -> { io.send(@method, "test") }.should raise_error(IOError)
io = StringIO.new("test")
io.close_write
- lambda { io.send(@method, "test") }.should raise_error(IOError)
+ -> { io.send(@method, "test") }.should raise_error(IOError)
end
end
diff --git a/spec/ruby/library/stringio/string_spec.rb b/spec/ruby/library/stringio/string_spec.rb
index 384986c161..1ed5233ba6 100644
--- a/spec/ruby/library/stringio/string_spec.rb
+++ b/spec/ruby/library/stringio/string_spec.rb
@@ -45,6 +45,6 @@ describe "StringIO#string=" do
end
it "raises a TypeError when the passed Object can't be converted to an Integer" do
- lambda { @io.seek(Object.new) }.should raise_error(TypeError)
+ -> { @io.seek(Object.new) }.should raise_error(TypeError)
end
end
diff --git a/spec/ruby/library/stringio/sysread_spec.rb b/spec/ruby/library/stringio/sysread_spec.rb
index ee69801444..8f78073f42 100644
--- a/spec/ruby/library/stringio/sysread_spec.rb
+++ b/spec/ruby/library/stringio/sysread_spec.rb
@@ -39,7 +39,7 @@ describe "StringIO#sysread when passed [length]" do
it "raises an EOFError when self's position is at the end" do
@io.pos = 7
- lambda { @io.sysread(10) }.should raise_error(EOFError)
+ -> { @io.sysread(10) }.should raise_error(EOFError)
end
it "returns an empty String when length is 0" do
diff --git a/spec/ruby/library/stringio/truncate_spec.rb b/spec/ruby/library/stringio/truncate_spec.rb
index d0d61af70a..ba910ee98c 100644
--- a/spec/ruby/library/stringio/truncate_spec.rb
+++ b/spec/ruby/library/stringio/truncate_spec.rb
@@ -35,8 +35,8 @@ describe "StringIO#truncate when passed [length]" do
end
it "raises an Errno::EINVAL when the passed length is negative" do
- lambda { @io.truncate(-1) }.should raise_error(Errno::EINVAL)
- lambda { @io.truncate(-10) }.should raise_error(Errno::EINVAL)
+ -> { @io.truncate(-1) }.should raise_error(Errno::EINVAL)
+ -> { @io.truncate(-10) }.should raise_error(Errno::EINVAL)
end
it "tries to convert the passed length to an Integer using #to_int" do
@@ -54,17 +54,17 @@ describe "StringIO#truncate when passed [length]" do
end
it "raises a TypeError when the passed length can't be converted to an Integer" do
- lambda { @io.truncate(Object.new) }.should raise_error(TypeError)
+ -> { @io.truncate(Object.new) }.should raise_error(TypeError)
end
end
describe "StringIO#truncate when self is not writable" do
it "raises an IOError" do
io = StringIO.new("test", "r")
- lambda { io.truncate(2) }.should raise_error(IOError)
+ -> { io.truncate(2) }.should raise_error(IOError)
io = StringIO.new("test")
io.close_write
- lambda { io.truncate(2) }.should raise_error(IOError)
+ -> { io.truncate(2) }.should raise_error(IOError)
end
end
diff --git a/spec/ruby/library/stringio/ungetc_spec.rb b/spec/ruby/library/stringio/ungetc_spec.rb
index 8a9205f390..91ef2100a1 100644
--- a/spec/ruby/library/stringio/ungetc_spec.rb
+++ b/spec/ruby/library/stringio/ungetc_spec.rb
@@ -39,7 +39,7 @@ describe "StringIO#ungetc when passed [char]" do
end
it "raises a TypeError when the passed length can't be converted to an Integer or String" do
- lambda { @io.ungetc(Object.new) }.should raise_error(TypeError)
+ -> { @io.ungetc(Object.new) }.should raise_error(TypeError)
end
end
@@ -47,12 +47,12 @@ describe "StringIO#ungetc when self is not readable" do
it "raises an IOError" do
io = StringIO.new("test", "w")
io.pos = 1
- lambda { io.ungetc(?A) }.should raise_error(IOError)
+ -> { io.ungetc(?A) }.should raise_error(IOError)
io = StringIO.new("test")
io.pos = 1
io.close_read
- lambda { io.ungetc(?A) }.should raise_error(IOError)
+ -> { io.ungetc(?A) }.should raise_error(IOError)
end
end