Skip to content

Commit c3791b5

Browse files
committed
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.
1 parent bdd839a commit c3791b5

File tree

3 files changed

+13
-0
lines changed

3 files changed

+13
-0
lines changed

template/{{app_name}}/.rubocop.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
plugins:
22
- rubocop-rspec
3+
- rubocop-rspec_rails
34
inherit_gem:
45
pundit: config/rubocop-rspec.yml
56
rubocop-rails-omakase: rubocop.yml
67

8+
AllCops:
9+
NewCops: disable
10+
711
RSpec/ExampleLength:
812
Enabled: false
913
RSpec/MultipleExpectations:
@@ -13,5 +17,8 @@ RSpec/NoExpectationExample:
1317
- assert_
1418
- is_expected_in_block
1519

20+
RSpecRails/HttpStatusNameConsistency:
21+
Enabled: true
22+
1623
Style/FrozenStringLiteralComment:
1724
Enabled: true

template/{{app_name}}/Gemfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ group :development do
9797
# Linting
9898
gem "rubocop-rails-omakase", require: false
9999
gem "rubocop-rspec", require: false
100+
gem "rubocop-rspec_rails", require: false
100101

101102
# Test notifications locally without sending the emails
102103
gem "letter_opener"

template/{{app_name}}/Gemfile.lock

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -446,6 +446,10 @@ GEM
446446
rubocop-rspec (3.7.0)
447447
lint_roller (~> 1.1)
448448
rubocop (~> 1.72, >= 1.72.1)
449+
rubocop-rspec_rails (2.32.0)
450+
lint_roller (~> 1.1)
451+
rubocop (~> 1.72, >= 1.72.1)
452+
rubocop-rspec (~> 3.5)
449453
ruby-graphviz (1.2.5)
450454
rexml
451455
ruby-progressbar (1.13.0)
@@ -558,6 +562,7 @@ DEPENDENCIES
558562
rspec-rails (~> 8.0.0)
559563
rubocop-rails-omakase
560564
rubocop-rspec
565+
rubocop-rspec_rails
561566
selenium-webdriver
562567
simplecov
563568
sprockets-rails

0 commit comments

Comments
 (0)