Class: RuboCop::Cop::RSpec::Rails::HttpStatus::NumericStyleChecker

Inherits:
StyleCheckerBase
  • Object
show all
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

#node

Instance Method Summary collapse

Methods inherited from StyleCheckerBase

#allowed_symbol?, #custom_http_status_code?, #initialize, #message, #offense_range

Constructor Details

This class inherits a constructor from RuboCop::Cop::RSpec::Rails::HttpStatus::StyleCheckerBase

Instance Method Details

#currentObject



151
152
153
# File 'lib/rubocop/cop/rspec/rails/http_status.rb', line 151

def current
  symbol.inspect
end

#offensive?Boolean

Returns:

  • (Boolean)


143
144
145
# File 'lib/rubocop/cop/rspec/rails/http_status.rb', line 143

def offensive?
  !node.int_type? && !allowed_symbol?
end

#preferObject



147
148
149
# File 'lib/rubocop/cop/rspec/rails/http_status.rb', line 147

def prefer
  number.to_s
end