diff options
Diffstat (limited to 'spec/ruby/core/string/insert_spec.rb')
-rw-r--r-- | spec/ruby/core/string/insert_spec.rb | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/spec/ruby/core/string/insert_spec.rb b/spec/ruby/core/string/insert_spec.rb index db42a37941..0c87df3a95 100644 --- a/spec/ruby/core/string/insert_spec.rb +++ b/spec/ruby/core/string/insert_spec.rb @@ -69,4 +69,13 @@ describe "String#insert with index, other" do "あれ".insert 0, pat end.should raise_error(Encoding::CompatibilityError) end + + it "should not call subclassed string methods" do + cls = Class.new(String) do + def replace(arg) + raise "should not call replace" + end + end + cls.new("abcd").insert(0, 'X').should == "Xabcd" + end end |