Skip to content

Commit 9025bee

Browse files
committed
Add safety note for autocorrection in have_http_status cop
1 parent 2d257f2 commit 9025bee

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

‎docs/modules/ROOT/pages/cops_rspecrails.adoc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,12 @@ end
5757
5858
Checks that tests use `have_http_status` instead of equality matchers.
5959
60+
[#safety-rspecrailshavehttpstatus]
61+
=== Safety
62+
63+
The autocorrection is marked as unsafe because
64+
`response.status` response is not always an HTTP response.
65+
6066
[#examples-rspecrailshavehttpstatus]
6167
=== Examples
6268

‎lib/rubocop/cop/rspec_rails/have_http_status.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ module Cop
55
module RSpecRails
66
# Checks that tests use `have_http_status` instead of equality matchers.
77
#
8+
# @safety
9+
# The autocorrection is marked as unsafe because
10+
# `response.status` response is not always an HTTP response.
11+
#
812
# @example ResponseMethods: ['response', 'last_response'] (default)
913
# # bad
1014
# expect(response.status).to be(200)

0 commit comments

Comments
 (0)