class RuboCop::Cop::RSpec::Rails::HttpStatus::SymbolicStyleChecker
Constants
- MSG
Attributes
node[R]
Public Class Methods
new(node)
click to toggle source
# File lib/rubocop/cop/rspec/rails/http_status.rb, line 72 def initialize(node) @node = node end
Public Instance Methods
message()
click to toggle source
# File lib/rubocop/cop/rspec/rails/http_status.rb, line 80 def message format(MSG, prefer: preferred_style, current: number.to_s) end
offensive?()
click to toggle source
# File lib/rubocop/cop/rspec/rails/http_status.rb, line 76 def offensive? !node.sym_type? && !custom_http_status_code? end
preferred_style()
click to toggle source
# File lib/rubocop/cop/rspec/rails/http_status.rb, line 84 def preferred_style symbol.inspect end
Private Instance Methods
custom_http_status_code?()
click to toggle source
# File lib/rubocop/cop/rspec/rails/http_status.rb, line 98 def custom_http_status_code? node.int_type? && !::Rack::Utils::SYMBOL_TO_STATUS_CODE.value?(node.source.to_i) end
number()
click to toggle source
# File lib/rubocop/cop/rspec/rails/http_status.rb, line 94 def number node.source.to_i end
symbol()
click to toggle source
# File lib/rubocop/cop/rspec/rails/http_status.rb, line 90 def symbol ::Rack::Utils::SYMBOL_TO_STATUS_CODE.key(number) end