From cac488a96042f2b6de43413362d0cf1048ce224c Mon Sep 17 00:00:00 2001 From: Mike Giver Date: Fri, 14 Nov 2025 15:14:00 -0500 Subject: [PATCH] Add rubocop-rspec_rails gem and enable HTTP status name consistency Adds the rubocop-rspec_rails gem to provide Rails-specific RSpec linting. Enables the RSpecRails/HttpStatusNameConsistency cop to enforce using :unprocessable_content instead of the deprecated :unprocessable_entity for HTTP 422 status codes. Sets NewCops to disabled to prevent automatic enablement of new cops in future gem updates, allowing us to evaluate and enable them deliberately. --- template/{{app_name}}/.rubocop.yml | 7 +++++++ template/{{app_name}}/Gemfile | 1 + template/{{app_name}}/Gemfile.lock | 5 +++++ 3 files changed, 13 insertions(+) diff --git a/template/{{app_name}}/.rubocop.yml b/template/{{app_name}}/.rubocop.yml index e15eb36..bfcc9be 100644 --- a/template/{{app_name}}/.rubocop.yml +++ b/template/{{app_name}}/.rubocop.yml @@ -1,9 +1,13 @@ plugins: - rubocop-rspec + - rubocop-rspec_rails inherit_gem: pundit: config/rubocop-rspec.yml rubocop-rails-omakase: rubocop.yml +AllCops: + NewCops: disable + RSpec/ExampleLength: Enabled: false RSpec/MultipleExpectations: @@ -13,5 +17,8 @@ RSpec/NoExpectationExample: - assert_ - is_expected_in_block +RSpecRails/HttpStatusNameConsistency: + Enabled: true + Style/FrozenStringLiteralComment: Enabled: true diff --git a/template/{{app_name}}/Gemfile b/template/{{app_name}}/Gemfile index af8c983..e06bcf6 100644 --- a/template/{{app_name}}/Gemfile +++ b/template/{{app_name}}/Gemfile @@ -97,6 +97,7 @@ group :development do # Linting gem "rubocop-rails-omakase", require: false gem "rubocop-rspec", require: false + gem "rubocop-rspec_rails", require: false # Test notifications locally without sending the emails gem "letter_opener" diff --git a/template/{{app_name}}/Gemfile.lock b/template/{{app_name}}/Gemfile.lock index 12dd215..05b820d 100644 --- a/template/{{app_name}}/Gemfile.lock +++ b/template/{{app_name}}/Gemfile.lock @@ -446,6 +446,10 @@ GEM rubocop-rspec (3.7.0) lint_roller (~> 1.1) rubocop (~> 1.72, >= 1.72.1) + rubocop-rspec_rails (2.32.0) + lint_roller (~> 1.1) + rubocop (~> 1.72, >= 1.72.1) + rubocop-rspec (~> 3.5) ruby-graphviz (1.2.5) rexml ruby-progressbar (1.13.0) @@ -558,6 +562,7 @@ DEPENDENCIES rspec-rails (~> 8.0.0) rubocop-rails-omakase rubocop-rspec + rubocop-rspec_rails selenium-webdriver simplecov sprockets-rails