Class: RuboCop::Cop::RSpec::Rails::HttpStatus::SymbolicStyleChecker
- Inherits:
-
Object
- Object
- RuboCop::Cop::RSpec::Rails::HttpStatus::SymbolicStyleChecker
- Defined in:
- lib/rubocop/cop/rspec/rails/http_status.rb
Overview
:nodoc:
Constant Summary collapse
- MSG =
'Prefer `%<prefer>s` over `%<current>s` ' \ 'to describe HTTP status code.'
Instance Attribute Summary collapse
-
#node ⇒ Object
readonly
Returns the value of attribute node.
Instance Method Summary collapse
-
#initialize(node) ⇒ SymbolicStyleChecker
constructor
A new instance of SymbolicStyleChecker.
- #message ⇒ Object
- #offensive? ⇒ Boolean
- #preferred_style ⇒ Object
Constructor Details
#initialize(node) ⇒ SymbolicStyleChecker
Returns a new instance of SymbolicStyleChecker.
73 74 75 |
# File 'lib/rubocop/cop/rspec/rails/http_status.rb', line 73 def initialize(node) @node = node end |
Instance Attribute Details
#node ⇒ Object (readonly)
Returns the value of attribute node.
72 73 74 |
# File 'lib/rubocop/cop/rspec/rails/http_status.rb', line 72 def node @node end |
Instance Method Details
#message ⇒ Object
81 82 83 |
# File 'lib/rubocop/cop/rspec/rails/http_status.rb', line 81 def format(MSG, prefer: preferred_style, current: number.to_s) end |
#offensive? ⇒ Boolean
77 78 79 |
# File 'lib/rubocop/cop/rspec/rails/http_status.rb', line 77 def offensive? !node.sym_type? && !custom_http_status_code? end |
#preferred_style ⇒ Object
85 86 87 |
# File 'lib/rubocop/cop/rspec/rails/http_status.rb', line 85 def preferred_style symbol.inspect end |