class RuboCop::Cop::Betterment::ServerErrorAssertion
Checks the status passed to have_http_status
If a number, enforces that it doesn't start with 5. If a symbol or a string, enforces that it's not one of:
-
internal_server_error
-
not_implemented
-
bad_gateway
-
service_unavailable
-
gateway_timeout
-
http_version_not_supported
-
insufficient_storage
-
not_extended
@example
# bad expect(response).to have_http_status :internal_server_error # bad expect(response).to have_http_status 500 # good expect(response).to have_http_status :forbidden # good expect(response).to have_http_status 422
Constants
- BAD_STATUSES
- MSG
Public Instance Methods
on_send(node)
click to toggle source
# File lib/rubocop/cop/betterment/server_error_assertion.rb, line 55 def on_send(node) return unless offensive_node?(node) add_offense(node) end