Skip to content

Replace Proc.new with proc#36

Open
tas50 wants to merge 1 commit into
chef:mainfrom
tas50:cleanup/proc-new
Open

Replace Proc.new with proc#36
tas50 wants to merge 1 commit into
chef:mainfrom
tas50:cleanup/proc-new

Conversation

@tas50

@tas50 tas50 commented Jun 28, 2026

Copy link
Copy Markdown

Summary

Replaces the three remaining uses of Proc.new with the proc Kernel method:

  • lib/chefspec.rb (define_matcher)
  • lib/chefspec/stubs/stub.rb (and_raise)
  • lib/chefspec/matchers/notifications_matcher.rb (matches?)

Proc.new is a legacy idiom — calling it without a block was deprecated and removed in modern Ruby, and the explicit constructor offers nothing over proc { ... }. This is a behavior-preserving readability/future-proofing cleanup.

Testing

  • bundle exec rspec spec/unit/162 examples, 0 failures.
  • cookstyle --chefstyle -c .rubocop.yml on the changed files → no offenses.

`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 <tsmith84@proton.me>
@tas50
tas50 requested review from a team and jaymzh as code owners June 28, 2026 05:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant