summaryrefslogtreecommitdiff
path: root/spec/ruby/core/proc/new_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/ruby/core/proc/new_spec.rb')
-rw-r--r--spec/ruby/core/proc/new_spec.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/spec/ruby/core/proc/new_spec.rb b/spec/ruby/core/proc/new_spec.rb
index cc033467e5..8faf142614 100644
--- a/spec/ruby/core/proc/new_spec.rb
+++ b/spec/ruby/core/proc/new_spec.rb
@@ -204,6 +204,14 @@ describe "Proc.new without a block" do
end
ruby_version_is "2.7" do
+ before :each do
+ @deprecated = Warning[:deprecated]
+ Warning[:deprecated] = true
+ end
+ after :each do
+ Warning[:deprecated] = @deprecated
+ end
+
it "can be created if invoked from within a method with a block" do
-> { ProcSpecs.new_proc_in_method { "hello" } }.should complain(/Capturing the given block using Proc.new is deprecated/)
end