From 5ef8ded88311cec38d785e8c3225002a5828310c Mon Sep 17 00:00:00 2001 From: Tim Smith Date: Sat, 27 Jun 2026 22:29:27 -0700 Subject: [PATCH] Replace Proc.new with proc `Proc.new` without a block is deprecated, and the bare `Proc.new` constructor offers no advantage over the `proc` Kernel method. Switch the three remaining call sites to `proc` for a clearer, future-proof idiom. Signed-off-by: Tim Smith --- lib/chefspec.rb | 2 +- lib/chefspec/matchers/notifications_matcher.rb | 2 +- lib/chefspec/stubs/stub.rb | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/chefspec.rb b/lib/chefspec.rb index 3301b3c0..c1a294f3 100644 --- a/lib/chefspec.rb +++ b/lib/chefspec.rb @@ -10,7 +10,7 @@ module ChefSpec # @return [self] # def define_matcher(resource_name) - matchers[resource_name.to_sym] = Proc.new do |identity| + matchers[resource_name.to_sym] = proc do |identity| find_resource(resource_name, identity) end diff --git a/lib/chefspec/matchers/notifications_matcher.rb b/lib/chefspec/matchers/notifications_matcher.rb index 8b31eaff..ee699e7e 100644 --- a/lib/chefspec/matchers/notifications_matcher.rb +++ b/lib/chefspec/matchers/notifications_matcher.rb @@ -12,7 +12,7 @@ def matches?(resource) @resource = resource if @resource - block = Proc.new do |notified| + block = proc do |notified| resource_name(notified.resource).to_s == @expected_resource_type && (@expected_resource_name === notified.resource.identity.to_s || @expected_resource_name === notified.resource.name.to_s) && matches_action?(notified) diff --git a/lib/chefspec/stubs/stub.rb b/lib/chefspec/stubs/stub.rb index 1570308a..c418ed50 100644 --- a/lib/chefspec/stubs/stub.rb +++ b/lib/chefspec/stubs/stub.rb @@ -9,7 +9,7 @@ def and_return(value) end def and_raise(exception) - @block = Proc.new { raise exception } + @block = proc { raise exception } self end