Class: RuboCop::Cop::Committee::UnspecifiedExpectedStatus
- Inherits:
-
Base
- Object
- Base
- RuboCop::Cop::Committee::UnspecifiedExpectedStatus
- Extended by:
- AutoCorrector
- Includes:
- RangeHelp
- Defined in:
- lib/rubocop/cop/committee/unspecified_expected_status.rb
Overview
Check if the status code is specified as an argument to the method of the Committee where the expected response status code is required.
Constant Summary collapse
- MSG =
"Specify the HTTP status code of the expected response as an argument."
- RESTRICT_ON_SEND =
%i[assert_schema_conform assert_response_schema_confirm].freeze
Instance Method Summary collapse
Instance Method Details
#have_http_status(node) ⇒ Object
31 32 33 |
# File 'lib/rubocop/cop/committee/unspecified_expected_status.rb', line 31 def_node_search :have_http_status, <<~PATTERN (send nil? :have_http_status (:int $_)) PATTERN |
#on_send(node) ⇒ Object
35 36 37 38 39 40 41 42 43 |
# File 'lib/rubocop/cop/committee/unspecified_expected_status.rb', line 35 def on_send(node) return if node.arguments? have_http_status(node.parent) do |status| return autocorrect(node, status) end add_offense(node) end |