Class: RuboCop::Cop::Minitest::AssertNil
- Inherits:
-
Base
- Object
- Base
- RuboCop::Cop::Minitest::AssertNil
- Extended by:
- AutoCorrector
- Includes:
- ArgumentRangeHelper, NilAssertionHandleable
- Defined in:
- lib/rubocop/cop/minitest/assert_nil.rb
Overview
Enforces the test to use ‘assert_nil` instead of using `assert_equal(nil, something)`, `assert(something.nil?)`, or `assert_predicate(something, :nil?)`.
Constant Summary collapse
- ASSERTION_TYPE =
'assert'
- RESTRICT_ON_SEND =
%i[assert assert_equal assert_predicate].freeze
Constants included from NilAssertionHandleable
Instance Method Summary collapse
Instance Method Details
#on_send(node) ⇒ Object
38 39 40 41 42 |
# File 'lib/rubocop/cop/minitest/assert_nil.rb', line 38 def on_send(node) nil_assertion(node) do |actual, | register_offense(node, actual, ) end end |