Class: RuboCop::Cop::RSpecRails::HttpStatusNameConsistency
- Inherits:
-
Base
- Object
- Base
- RuboCop::Cop::RSpecRails::HttpStatusNameConsistency
- Extended by:
- AutoCorrector
- Defined in:
- lib/rubocop/cop/rspec_rails/http_status_name_consistency.rb
Overview
Enforces consistency by using the current HTTP status names.
Constant Summary collapse
- MSG =
'Use `Prefer `:%<preferred>s` over `:%<current>s`.'- RESTRICT_ON_SEND =
i[have_http_status].freeze
- PREFERRED_STATUSES =
{ unprocessable_entity: :unprocessable_content, payload_too_large: :content_too_large }.freeze
Instance Method Summary collapse
- #http_status(node) ⇒ Object
- #on_send(node) ⇒ Object (also: #on_csend)
Instance Method Details
#http_status(node) ⇒ Object
31 32 33 |
# File 'lib/rubocop/cop/rspec_rails/http_status_name_consistency.rb', line 31 def_node_matcher :http_status, "(send nil? :have_http_status ${sym})\n" |
#on_send(node) ⇒ Object Also known as: on_csend
35 36 37 38 39 |
# File 'lib/rubocop/cop/rspec_rails/http_status_name_consistency.rb', line 35 def on_send(node) http_status(node) do |arg| check_status_name_consistency(arg) end end |