Class: RuboCop::Cop::Workit::RSpecRedundantHttpStatus
- Inherits:
-
Base
- Object
- Base
- RuboCop::Cop::Workit::RSpecRedundantHttpStatus
- Extended by:
- AutoCorrector
- Includes:
- RangeHelp
- Defined in:
- lib/rubocop/cop/workit/rspec_redundant_http_status.rb
Overview
Check for validation of redundant response HTTP status codes.
Constant Summary collapse
- MSG =
"Remove redundant HTTP response status code validation."
- RESTRICT_ON_SEND =
%i[assert_schema_conform assert_response_schema_confirm].freeze
Instance Method Summary collapse
Instance Method Details
#have_http_status(node) ⇒ Object
30 31 32 |
# File 'lib/rubocop/cop/workit/rspec_redundant_http_status.rb', line 30 def_node_search :have_http_status, <<~PATTERN $(send nil? :have_http_status (:int _)) PATTERN |
#on_send(node) ⇒ Object
34 35 36 37 38 39 40 |
# File 'lib/rubocop/cop/workit/rspec_redundant_http_status.rb', line 34 def on_send(node) return if node.first_argument.nil? have_http_status(node.parent) do |http_node| return autocorrect(node, http_node.parent.loc.expression) end end |