summaryrefslogtreecommitdiff
path: root/spec/ruby/core/string/center_spec.rb
diff options
context:
space:
mode:
authorBenoit Daloze <eregontp@gmail.com>2019-07-27 12:40:09 +0200
committerBenoit Daloze <eregontp@gmail.com>2019-07-27 12:40:09 +0200
commit5c276e1cc91c5ab2a41fbf7827af2fed914a2bc0 (patch)
tree05b5c68c8b2a00224d4646ea3b26ce3877efaadd /spec/ruby/core/string/center_spec.rb
parenta06301b103371b0b7da8eaca26ba744961769f99 (diff)
Update to ruby/spec@875a09e
Diffstat (limited to 'spec/ruby/core/string/center_spec.rb')
-rw-r--r--spec/ruby/core/string/center_spec.rb20
1 files changed, 10 insertions, 10 deletions
diff --git a/spec/ruby/core/string/center_spec.rb b/spec/ruby/core/string/center_spec.rb
index 3a9e689eac..27f8b7387f 100644
--- a/spec/ruby/core/string/center_spec.rb
+++ b/spec/ruby/core/string/center_spec.rb
@@ -65,10 +65,10 @@ describe "String#center with length, padding" do
end
it "raises a TypeError when length can't be converted to an integer" do
- lambda { "hello".center("x") }.should raise_error(TypeError)
- lambda { "hello".center("x", "y") }.should raise_error(TypeError)
- lambda { "hello".center([]) }.should raise_error(TypeError)
- lambda { "hello".center(mock('x')) }.should raise_error(TypeError)
+ -> { "hello".center("x") }.should raise_error(TypeError)
+ -> { "hello".center("x", "y") }.should raise_error(TypeError)
+ -> { "hello".center([]) }.should raise_error(TypeError)
+ -> { "hello".center(mock('x')) }.should raise_error(TypeError)
end
it "calls #to_str to convert padstr to a String" do
@@ -79,14 +79,14 @@ describe "String#center with length, padding" do
end
it "raises a TypeError when padstr can't be converted to a string" do
- lambda { "hello".center(20, 100) }.should raise_error(TypeError)
- lambda { "hello".center(20, []) }.should raise_error(TypeError)
- lambda { "hello".center(20, mock('x')) }.should raise_error(TypeError)
+ -> { "hello".center(20, 100) }.should raise_error(TypeError)
+ -> { "hello".center(20, []) }.should raise_error(TypeError)
+ -> { "hello".center(20, mock('x')) }.should raise_error(TypeError)
end
it "raises an ArgumentError if padstr is empty" do
- lambda { "hello".center(10, "") }.should raise_error(ArgumentError)
- lambda { "hello".center(0, "") }.should raise_error(ArgumentError)
+ -> { "hello".center(10, "") }.should raise_error(ArgumentError)
+ -> { "hello".center(0, "") }.should raise_error(ArgumentError)
end
it "returns subclass instances when called on subclasses" do
@@ -123,7 +123,7 @@ describe "String#center with length, padding" do
it "raises an Encoding::CompatibilityError if the encodings are incompatible" do
pat = "ア".encode Encoding::EUC_JP
- lambda do
+ -> do
"あれ".center 5, pat
end.should raise_error(Encoding::CompatibilityError)
end