Class: RuboCop::Cop::Rails::AssertNot
- Inherits:
-
Base
- Object
- Base
- RuboCop::Cop::Rails::AssertNot
- Extended by:
- AutoCorrector
- Defined in:
- lib/rubocop/cop/rails/assert_not.rb
Overview
Use ‘assert_not` instead of `assert !`.
Constant Summary collapse
- MSG =
'Prefer `assert_not` over `assert !`.'
- RESTRICT_ON_SEND =
%i[assert].freeze
Instance Method Summary collapse
Instance Method Details
#on_send(node) ⇒ Object
23 24 25 26 27 28 29 30 31 |
# File 'lib/rubocop/cop/rails/assert_not.rb', line 23 def on_send(node) return unless offensive?(node) add_offense(node) do |corrector| expression = node.source_range corrector.replace(expression, corrected_source(expression.source)) end end |