summaryrefslogtreecommitdiff
path: root/spec/ruby/core/string/gsub_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/ruby/core/string/gsub_spec.rb')
-rw-r--r--spec/ruby/core/string/gsub_spec.rb5
1 files changed, 5 insertions, 0 deletions
diff --git a/spec/ruby/core/string/gsub_spec.rb b/spec/ruby/core/string/gsub_spec.rb
index 54a2be0fed..6789199ff3 100644
--- a/spec/ruby/core/string/gsub_spec.rb
+++ b/spec/ruby/core/string/gsub_spec.rb
@@ -475,6 +475,11 @@ describe "String#gsub with pattern and block" do
offsets.should == [[1, 2], [4, 5]]
end
+ it "does not set $~ for procs created from methods" do
+ str = "hello"
+ str.gsub("l", &StringSpecs::SpecialVarProcessor.new.method(:process)).should == "he<unset><unset>o"
+ end
+
it "restores $~ after leaving the block" do
[/./, "l"].each do |pattern|
old_md = nil