From 2b366053b50a758f9f6d1f7c4f7340f684d3e360 Mon Sep 17 00:00:00 2001 From: Eric Proulx Date: Sun, 21 Jun 2026 07:44:00 +0200 Subject: [PATCH] Update rubocop to 1.88.0 and rubocop-rspec to 3.10.2 Bump RuboCop and rubocop-rspec, and fix the spec offenses the new versions flag (prefer `include` over `match` for plain-string matchers). Co-Authored-By: Claude Opus 4.8 (1M context) --- CHANGELOG.md | 1 + Gemfile | 4 ++-- spec/grape/api_spec.rb | 4 ++-- spec/grape/validations/params_scope_spec.rb | 2 +- spec/grape/validations/validators/oneof_validator_spec.rb | 6 +++--- spec/grape/validations_spec.rb | 4 ++-- 6 files changed, 11 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 339d3a518..613e12343 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ #### Fixes +* [#2767](https://github.com/ruby-grape/grape/pull/2767): Update rubocop to 1.88.0 and rubocop-rspec to 3.10.2 - [@ericproulx](https://github.com/ericproulx). * Your contribution here. ### 3.3.0 (2026-06-20) diff --git a/Gemfile b/Gemfile index 468c73fd0..f5a5a1421 100644 --- a/Gemfile +++ b/Gemfile @@ -8,9 +8,9 @@ group :development, :test do gem 'builder', require: false gem 'bundler' gem 'rake' - gem 'rubocop', '1.86.0', require: false + gem 'rubocop', '1.88.0', require: false gem 'rubocop-performance', '1.26.1', require: false - gem 'rubocop-rspec', '3.9.0', require: false + gem 'rubocop-rspec', '3.10.2', require: false end group :development do diff --git a/spec/grape/api_spec.rb b/spec/grape/api_spec.rb index 1b954c32d..a118a8dcc 100644 --- a/spec/grape/api_spec.rb +++ b/spec/grape/api_spec.rb @@ -3691,8 +3691,8 @@ def self.call(object, _env) mount app end expect(subject.routes.size).to eq(2) - expect(subject.routes.first.path).to match(%r{/cool/awesome}) - expect(subject.routes.last.path).to match(%r{/cool/sauce}) + expect(subject.routes.first.path).to include('/cool/awesome') + expect(subject.routes.last.path).to include('/cool/sauce') end it 'mounts on a path' do diff --git a/spec/grape/validations/params_scope_spec.rb b/spec/grape/validations/params_scope_spec.rb index 371184f64..c432265aa 100644 --- a/spec/grape/validations/params_scope_spec.rb +++ b/spec/grape/validations/params_scope_spec.rb @@ -39,7 +39,7 @@ def initialize(value) get '/types', foo: 'invalid' expect(last_response.status).to eq(400) - expect(last_response.body).to match(/foo is invalid/) + expect(last_response.body).to include('foo is invalid') end end diff --git a/spec/grape/validations/validators/oneof_validator_spec.rb b/spec/grape/validations/validators/oneof_validator_spec.rb index 7cf3fa0b2..7d403f42e 100644 --- a/spec/grape/validations/validators/oneof_validator_spec.rb +++ b/spec/grape/validations/validators/oneof_validator_spec.rb @@ -85,19 +85,19 @@ it 'rejects values that do not match any variant' do post '/pricing', { value: { time_unit: 'hour', rate: 'not-a-number' } }.to_json, 'CONTENT_TYPE' => 'application/json' expect(last_response.status).to eq(400) - expect(JSON.parse(last_response.body)['error']).to match(/does not match any of the allowed schemas/) + expect(JSON.parse(last_response.body)['error']).to include('does not match any of the allowed schemas') end it 'rejects values with no matching keys' do post '/pricing', { value: { something_else: 1 } }.to_json, 'CONTENT_TYPE' => 'application/json' expect(last_response.status).to eq(400) - expect(JSON.parse(last_response.body)['error']).to match(/does not match any of the allowed schemas/) + expect(JSON.parse(last_response.body)['error']).to include('does not match any of the allowed schemas') end it 'rejects when the value key is missing entirely' do post '/pricing', '{}', 'CONTENT_TYPE' => 'application/json' expect(last_response.status).to eq(400) - expect(JSON.parse(last_response.body)['error']).to match(/value is missing/) + expect(JSON.parse(last_response.body)['error']).to include('value is missing') end end diff --git a/spec/grape/validations_spec.rb b/spec/grape/validations_spec.rb index 9080710b4..9b3b73099 100644 --- a/spec/grape/validations_spec.rb +++ b/spec/grape/validations_spec.rb @@ -1253,8 +1253,8 @@ def validate_param!(attr_name, params) it 'throws the validation errors' do get '/two_required' expect(last_response.status).to eq(400) - expect(last_response.body).to match(/yolo is missing/) - expect(last_response.body).to match(/swag is missing/) + expect(last_response.body).to include('yolo is missing') + expect(last_response.body).to include('swag is missing') end end