Class: RuboCop::Cop::RSpec::Rails::HttpStatus::BeStatusStyleChecker
- Inherits:
-
StyleCheckerBase
- Object
- StyleCheckerBase
- RuboCop::Cop::RSpec::Rails::HttpStatus::BeStatusStyleChecker
- Defined in:
- lib/rubocop/cop/rspec/rails/http_status.rb
Overview
:nodoc:
Constant Summary
Constants inherited from StyleCheckerBase
StyleCheckerBase::ALLOWED_STATUSES, StyleCheckerBase::MSG
Instance Attribute Summary
Attributes inherited from StyleCheckerBase
Instance Method Summary collapse
Methods inherited from StyleCheckerBase
#allowed_symbol?, #custom_http_status_code?, #initialize, #message
Constructor Details
This class inherits a constructor from RuboCop::Cop::RSpec::Rails::HttpStatus::StyleCheckerBase
Instance Method Details
#current ⇒ Object
185 186 187 |
# File 'lib/rubocop/cop/rspec/rails/http_status.rb', line 185 def current offense_range.source end |
#offense_range ⇒ Object
173 174 175 |
# File 'lib/rubocop/cop/rspec/rails/http_status.rb', line 173 def offense_range node.parent end |
#offensive? ⇒ Boolean
168 169 170 171 |
# File 'lib/rubocop/cop/rspec/rails/http_status.rb', line 168 def offensive? (!node.sym_type? && !custom_http_status_code?) || (!node.int_type? && !allowed_symbol?) end |
#prefer ⇒ Object
177 178 179 180 181 182 183 |
# File 'lib/rubocop/cop/rspec/rails/http_status.rb', line 177 def prefer if node.sym_type? "be_#{node.value}" else "be_#{symbol}" end end |