From 98ef38ada43338c073f50a0093196f0356284625 Mon Sep 17 00:00:00 2001 From: Jean Boussier Date: Wed, 27 Nov 2019 11:40:18 +0000 Subject: Freeze Regexp literals [Feature #8948] [Feature #16377] Since Regexp literals always reference the same instance, allowing to mutate them can lead to state leak. --- spec/ruby/core/string/match_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'spec/ruby/core/string') diff --git a/spec/ruby/core/string/match_spec.rb b/spec/ruby/core/string/match_spec.rb index 78b94baa44..5e988f34ca 100644 --- a/spec/ruby/core/string/match_spec.rb +++ b/spec/ruby/core/string/match_spec.rb @@ -137,7 +137,7 @@ describe "String#match" do end it "calls match on the regular expression" do - regexp = /./ + regexp = /./.dup regexp.should_receive(:match).and_return(:foo) 'hello'.match(regexp).should == :foo end -- cgit v1.2.3