Skip to content

Upgrade rspec-parameterized to >= 1.0

Peter Leitzen requested to merge pl-upgrade-rspec-parameterized into master

What does this MR do and why?

This upgrade to support Ruby 3.2 because Refinenment#include was removed (see gitlab-org/ruby/gems/gitlab-styles!147 (diffs, comment 1231921310)).

This upgrade brings back binding_of_caller gem as transient dependency of rspec-parameterized. Earlier, it was removed in !41629 (merged) due to security concerns.

Now, this functionality is disabled in BetterErrors explicitly and REPL remains unavailable in development mode.

This MR also silences (via Warning.ignore) a Ruby warning stemming from rspec-parameterized-table_syntax on Ruby < 3.2 (see https://gitlab.com/gitlab-org/gitlab/-/jobs/3927513103#L2096) related to Refinement#include is deprecated and will be removed in Ruby 3.2.

/builds/gitlab-org/gitlab/vendor/ruby/3.1.0/gems/rspec-parameterized-table_syntax-1.0.0/lib/rspec/parameterized/table_syntax.rb:42: warning: Refinement#include is deprecated and will be removed in Ruby 3.2
/builds/gitlab-org/gitlab/vendor/ruby/3.1.0/gems/rspec-parameterized-table_syntax-1.0.0/lib/rspec/parameterized/table_syntax.rb:46: warning: Refinement#include is deprecated and will be removed in Ruby 3.2
/builds/gitlab-org/gitlab/vendor/ruby/3.1.0/gems/rspec-parameterized-table_syntax-1.0.0/lib/rspec/parameterized/table_syntax.rb:50: warning: Refinement#include is deprecated and will be removed in Ruby 3.2
/builds/gitlab-org/gitlab/vendor/ruby/3.1.0/gems/rspec-parameterized-table_syntax-1.0.0/lib/rspec/parameterized/table_syntax.rb:54: warning: Refinement#include is deprecated and will be removed in Ruby 3.2
/builds/gitlab-org/gitlab/vendor/ruby/3.1.0/gems/rspec-parameterized-table_syntax-1.0.0/lib/rspec/parameterized/table_syntax.rb:58: warning: Refinement#include is deprecated and will be removed in Ruby 3.2

Refs !114366 (comment 1311413752).

Gem diffs

Screenshots or screen recordings

Before (on master without binding_of_caller) After (this MR with binding_of_caller disabled)
Screenshot_from_2023-03-13_16-10-09 Screenshot_from_2023-03-13_16-21-48

So, binding_of_caller is required but is not enabled and thus REPL not available.

How to set up and validate locally

master

  1. Checkout master via git checkout master
  2. Apply raise debug patch via `git apply'
diff --git a/app/views/layouts/_head.html.haml b/app/views/layouts/_head.html.haml
index f0c1b0901403..3ee22b130fb3 100644
--- a/app/views/layouts/_head.html.haml
+++ b/app/views/layouts/_head.html.haml
@@ -1,3 +1,4 @@
+- raise({ ruby_version: RUBY_VERSION, binding_of_caller_required: $LOADED_FEATURES.grep(/binding_of_caller/).count > 0, binding_of_caller_enabled: BetterErrors.binding_of_caller_available}.inspect)
 - page_description brand_title unless page_description
 - site_name = _('GitLab')
 %head{ prefix: "og: http://ogp.me/ns#" }
  1. Visit http://localhost:3000/ and see error page with RuntimeError

This branch

  1. Checkout this branch via git checkout pl-upgrade-rspec-parameterized
  2. Switch to Ruby 3.1 via asdf local ruby 3.1.3
  3. Apply raise debug patch from above
  4. Checkout Gemfile changes from !114366 (closed) via git checkout sh-test-ruby-3.1 Gemfile Gemfile.lock
  5. bundle and gdk restart

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Peter Leitzen

Merge request reports