Skip to content

Commit

Permalink
Add safety note for autocorrection in have_http_status cop
Browse files Browse the repository at this point in the history
  • Loading branch information
ydah committed Feb 14, 2025
1 parent 2d257f2 commit 9025bee
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
6 changes: 6 additions & 0 deletions docs/modules/ROOT/pages/cops_rspecrails.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,12 @@ end
Checks that tests use `have_http_status` instead of equality matchers.
[#safety-rspecrailshavehttpstatus]
=== Safety
The autocorrection is marked as unsafe because
`response.status` response is not always an HTTP response.
[#examples-rspecrailshavehttpstatus]
=== Examples
Expand Down
4 changes: 4 additions & 0 deletions lib/rubocop/cop/rspec_rails/have_http_status.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ module Cop
module RSpecRails
# Checks that tests use `have_http_status` instead of equality matchers.
#
# @safety
# The autocorrection is marked as unsafe because
# `response.status` response is not always an HTTP response.
#
# @example ResponseMethods: ['response', 'last_response'] (default)
# # bad
# expect(response.status).to be(200)
Expand Down

0 comments on commit 9025bee

Please sign in to comment.