diff options
author | Benoit Daloze <eregontp@gmail.com> | 2019-07-27 12:40:09 +0200 |
---|---|---|
committer | Benoit Daloze <eregontp@gmail.com> | 2019-07-27 12:40:09 +0200 |
commit | 5c276e1cc91c5ab2a41fbf7827af2fed914a2bc0 (patch) | |
tree | 05b5c68c8b2a00224d4646ea3b26ce3877efaadd /spec/ruby/core/string/insert_spec.rb | |
parent | a06301b103371b0b7da8eaca26ba744961769f99 (diff) | |
download | ruby-5c276e1cc91c5ab2a41fbf7827af2fed914a2bc0.tar.gz |
Update to ruby/spec@875a09e
Diffstat (limited to 'spec/ruby/core/string/insert_spec.rb')
-rw-r--r-- | spec/ruby/core/string/insert_spec.rb | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/spec/ruby/core/string/insert_spec.rb b/spec/ruby/core/string/insert_spec.rb index d5b9026f3d..588b8ab272 100644 --- a/spec/ruby/core/string/insert_spec.rb +++ b/spec/ruby/core/string/insert_spec.rb @@ -23,8 +23,8 @@ describe "String#insert with index, other" do end it "raises an IndexError if the index is beyond string" do - lambda { "abcd".insert(5, 'X') }.should raise_error(IndexError) - lambda { "abcd".insert(-6, 'X') }.should raise_error(IndexError) + -> { "abcd".insert(5, 'X') }.should raise_error(IndexError) + -> { "abcd".insert(-6, 'X') }.should raise_error(IndexError) end it "converts index to an integer using to_int" do @@ -52,15 +52,15 @@ describe "String#insert with index, other" do end it "raises a TypeError if other can't be converted to string" do - lambda { "abcd".insert(-6, Object.new)}.should raise_error(TypeError) - lambda { "abcd".insert(-6, []) }.should raise_error(TypeError) - lambda { "abcd".insert(-6, mock('x')) }.should raise_error(TypeError) + -> { "abcd".insert(-6, Object.new)}.should raise_error(TypeError) + -> { "abcd".insert(-6, []) }.should raise_error(TypeError) + -> { "abcd".insert(-6, mock('x')) }.should raise_error(TypeError) end it "raises a #{frozen_error_class} if self is frozen" do str = "abcd".freeze - lambda { str.insert(4, '') }.should raise_error(frozen_error_class) - lambda { str.insert(4, 'X') }.should raise_error(frozen_error_class) + -> { str.insert(4, '') }.should raise_error(frozen_error_class) + -> { str.insert(4, 'X') }.should raise_error(frozen_error_class) end it "inserts a character into a multibyte encoded string" do @@ -75,7 +75,7 @@ describe "String#insert with index, other" do it "raises an Encoding::CompatibilityError if the encodings are incompatible" do pat = "ア".encode Encoding::EUC_JP - lambda do + -> do "あれ".insert 0, pat end.should raise_error(Encoding::CompatibilityError) end |