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