From 74fd99a86c718d1bb7f240e02a49c869cbbd53b0 Mon Sep 17 00:00:00 2001 From: Koichi ITO Date: Sat, 27 Jun 2026 14:46:36 +0900 Subject: [PATCH] Fix a `NoMethodError` on Ruby 2.7 caused by `Hash#except` ## Motivation and Context The gemspec already declares `required_ruby_version >= 2.7.0`, but the conformance Rake task used `Hash#except` to drop the `:port` option before handing the remaining options to `Conformance::ClientRunner`. `Hash#except` was only added in Ruby 3.0, so running `rake conformance` on Ruby 2.7 aborted before any scenario ran, raising `NoMethodError: undefined method except for {}:Hash`. CI missed this because no job runs `rake conformance` on Ruby 2.7: the conformance workflow runs only on Ruby 4.0, while the Ruby 2.7.0 matrix entry runs `rake test` alone. ## How Has This Been Tested? Replace `options.except(:port)` with `options.reject { |key, _| key == :port }`, which has been available since well before Ruby 2.7 and returns an equivalent Hash without mutating the original. `rake conformance` now runs the full suite on Ruby 2.7, and its baseline still passes on current Ruby, verified on Ruby 4.0. ## Breaking Changes None. --- Rakefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Rakefile b/Rakefile index 62e92d57..36da72c2 100644 --- a/Rakefile +++ b/Rakefile @@ -30,7 +30,7 @@ task :conformance do |t| options[:verbose] = true if ENV["VERBOSE"] Conformance::ServerRunner.new(**options).run - Conformance::ClientRunner.new(**options.except(:port)).run + Conformance::ClientRunner.new(**options.reject { |key, _value| key == :port }).run end desc "List available conformance scenarios"