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 73 def initialize(node) @node = node end
Public Instance Methods
message()
click to toggle source
# File lib/rubocop/cop/rspec/rails/http_status.rb, line 81 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 77 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 85 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 99 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 95 def number node.source.to_i end
symbol()
click to toggle source
# File lib/rubocop/cop/rspec/rails/http_status.rb, line 91 def symbol ::Rack::Utils::SYMBOL_TO_STATUS_CODE.key(number) end