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.'.freeze
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.
72 73 74 |
# File 'lib/rubocop/cop/rspec/rails/http_status.rb', line 72 def initialize(node) @node = node end |
Instance Attribute Details
#node ⇒ Object (readonly)
Returns the value of attribute node.
71 72 73 |
# File 'lib/rubocop/cop/rspec/rails/http_status.rb', line 71 def node @node end |
Instance Method Details
#message ⇒ Object
80 81 82 |
# File 'lib/rubocop/cop/rspec/rails/http_status.rb', line 80 def format(MSG, prefer: preferred_style, current: number.to_s) end |
#offensive? ⇒ Boolean
76 77 78 |
# File 'lib/rubocop/cop/rspec/rails/http_status.rb', line 76 def offensive? !node.sym_type? && !custom_http_status_code? end |
#preferred_style ⇒ Object
84 85 86 |
# File 'lib/rubocop/cop/rspec/rails/http_status.rb', line 84 def preferred_style symbol.inspect end |