From 48a4629b221970dd80556c037915280cea408c59 Mon Sep 17 00:00:00 2001 From: Shaun McCormick Date: Wed, 7 Jan 2026 16:25:42 -0600 Subject: [PATCH] Add Ruby 4.x support --- .circleci/config.yml | 21 +++++++++++++++++++++ CHANGELOG.md | 4 ++++ README.md | 2 +- gruf.gemspec | 2 +- spec/gruf/client/error_factory_spec.rb | 16 ++++++++-------- 5 files changed, 35 insertions(+), 10 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index e592199..62f0347 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -49,6 +49,12 @@ executors: ruby-version: type: string default: "3.4" + ruby_4_0: + <<: *ruby_env + parameters: + ruby-version: + type: string + default: "4.0" commands: pre-setup: @@ -259,3 +265,18 @@ workflows: - e2e: name: "ruby-3_4-e2e" e: "ruby_3_4" + ruby_4_0: + jobs: + - bundle-audit: + name: "ruby-4_0-bundle_audit" + e: "ruby_4_0" + - rubocop: + name: "ruby-4_0-rubocop" + e: "ruby_4_0" + - rspec-unit: + name: "ruby-4_0-rspec" + e: "ruby_4_0" + code-climate: false + - e2e: + name: "ruby-4_0-e2e" + e: "ruby_4_0" diff --git a/CHANGELOG.md b/CHANGELOG.md index b45f06f..7c30eb3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ Changelog for the gruf gem. This includes internal history before the gem was ma ### Pending release +### 2.22.0 + +* Add support for Ruby 4.x + ### 2.21.1 * [#230] Add fix for load order issues with reloader in some non-Rails environments diff --git a/README.md b/README.md index 47bbc60..9b3f82e 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ up fast and efficiently at scale. Some of its features include: still preserving gRPC BadStatus codes * Server and client execution timings in responses -gruf currently has active support for gRPC 1.10.x+. gruf is compatible and tested with Ruby 3.0-3.4. +gruf currently has active support for gRPC 1.10.x+. gruf is compatible and tested with Ruby 3.x-4.0. gruf is also not [Rails](https://github.com/rails/rails)-specific, and can be used in any Ruby framework (such as [Grape](https://github.com/ruby-grape/grape) or [dry-rb](https://dry-rb.org/), for instance). diff --git a/gruf.gemspec b/gruf.gemspec index 4dd6615..7f7dc61 100644 --- a/gruf.gemspec +++ b/gruf.gemspec @@ -36,7 +36,7 @@ Gem::Specification.new do |spec| # supported by grpc gem before bumping the maximum Ruby major version that this gem officially supports. # grpc gem has a history of lagging behind the latest Ruby version support post-new-year every year. # See: https://github.com/bigcommerce/gruf/pull/221#issuecomment-2573428792 - spec.required_ruby_version = '>= 3.0', '< 3.5' + spec.required_ruby_version = '>= 3.0', '< 5.0' spec.metadata = { 'bug_tracker_uri' => 'https://github.com/bigcommerce/gruf/issues', diff --git a/spec/gruf/client/error_factory_spec.rb b/spec/gruf/client/error_factory_spec.rb index 4605dc2..1467612 100644 --- a/spec/gruf/client/error_factory_spec.rb +++ b/spec/gruf/client/error_factory_spec.rb @@ -40,15 +40,15 @@ Gruf::Client::Errors.constants .reject { |e| rejected_exceptions.include?(e) } .each do |error_class| - context "and is a GRPC::#{error_class} exception" do - let(:exception) { "GRPC::#{error_class}".constantize.new(error_message) } - let(:expected_class) { "Gruf::Client::Errors::#{error_class}".constantize } + context "when is a GRPC::#{error_class} exception" do + let(:exception) { "GRPC::#{error_class}".constantize.new(error_message) } + let(:expected_class) { "Gruf::Client::Errors::#{error_class}".constantize } - it "wraps it with the Gruf::Client::Errors::#{error_class} class" do - expect(subject).to be_a(expected_class) - expect(subject.error).to eq exception - end - end + it "wraps it with the Gruf::Client::Errors::#{error_class} class" do + expect(subject).to be_a(expected_class) + expect(subject.error).to eq exception + end + end end end