summaryrefslogtreecommitdiff
path: root/spec/ruby/core/string/insert_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/ruby/core/string/insert_spec.rb')
-rw-r--r--spec/ruby/core/string/insert_spec.rb16
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 483f3c9367..c89793a8ca 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
- -> { "abcd".insert(5, 'X') }.should raise_error(IndexError)
- -> { "abcd".insert(-6, 'X') }.should raise_error(IndexError)
+ -> { "abcd".insert(5, 'X') }.should.raise(IndexError)
+ -> { "abcd".insert(-6, 'X') }.should.raise(IndexError)
end
it "converts index to an integer using to_int" do
@@ -42,15 +42,15 @@ describe "String#insert with index, other" do
end
it "raises a TypeError if other can't be converted to string" do
- -> { "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)
+ -> { "abcd".insert(-6, Object.new)}.should.raise(TypeError)
+ -> { "abcd".insert(-6, []) }.should.raise(TypeError)
+ -> { "abcd".insert(-6, mock('x')) }.should.raise(TypeError)
end
it "raises a FrozenError if self is frozen" do
str = "abcd".freeze
- -> { str.insert(4, '') }.should raise_error(FrozenError)
- -> { str.insert(4, 'X') }.should raise_error(FrozenError)
+ -> { str.insert(4, '') }.should.raise(FrozenError)
+ -> { str.insert(4, 'X') }.should.raise(FrozenError)
end
it "inserts a character into a multibyte encoded string" do
@@ -67,7 +67,7 @@ describe "String#insert with index, other" do
pat = "ア".encode Encoding::EUC_JP
-> do
"あれ".insert 0, pat
- end.should raise_error(Encoding::CompatibilityError)
+ end.should.raise(Encoding::CompatibilityError)
end
it "should not call subclassed string methods" do