class RuboCop::Cop::RSpec::Rails::HttpStatus::NumericStyleChecker
Constants
- ALLOWED_STATUSES
- MSG
Attributes
node[R]
Public Class Methods
new(node)
click to toggle source
# File lib/rubocop/cop/rspec/rails/http_status.rb, line 113 def initialize(node) @node = node end
Public Instance Methods
message()
click to toggle source
# File lib/rubocop/cop/rspec/rails/http_status.rb, line 121 def message format(MSG, prefer: preferred_style, current: symbol.inspect) end
offensive?()
click to toggle source
# File lib/rubocop/cop/rspec/rails/http_status.rb, line 117 def offensive? !node.int_type? && !allowed_symbol? end
preferred_style()
click to toggle source
# File lib/rubocop/cop/rspec/rails/http_status.rb, line 125 def preferred_style number.to_s end
Private Instance Methods
allowed_symbol?()
click to toggle source
# File lib/rubocop/cop/rspec/rails/http_status.rb, line 139 def allowed_symbol? node.sym_type? && ALLOWED_STATUSES.include?(node.value) end
number()
click to toggle source
# File lib/rubocop/cop/rspec/rails/http_status.rb, line 131 def number ::Rack::Utils::SYMBOL_TO_STATUS_CODE[symbol] end
symbol()
click to toggle source
# File lib/rubocop/cop/rspec/rails/http_status.rb, line 135 def symbol node.value end