Class: RuboCop::Cop::RSpecRails::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, StyleCheckerBase::MSG_UNKNOWN_STATUS_CODE

Instance Attribute Summary

Attributes inherited from StyleCheckerBase

#node

Instance Method Summary collapse

Methods inherited from StyleCheckerBase

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

Constructor Details

This class inherits a constructor from RuboCop::Cop::RSpecRails::HttpStatus::StyleCheckerBase

Instance Method Details

#autocorrectable?Boolean

Returns:

  • (Boolean)

182
183
184
# File 'lib/rubocop/cop/rspec_rails/http_status.rb', line 182

def autocorrectable?
  !!number
end

#offensive?Boolean

Returns:

  • (Boolean)

178
179
180
# File 'lib/rubocop/cop/rspec_rails/http_status.rb', line 178

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

#preferObject


186
187
188
# File 'lib/rubocop/cop/rspec_rails/http_status.rb', line 186

def prefer
  number.to_s
end