Class: RuboCop::Cop::Minitest::RefuteEmpty
- Inherits:
-
Base
- Object
- Base
- RuboCop::Cop::Minitest::RefuteEmpty
- Extended by:
- RuboCop::Cop::MinitestCopRule
- Defined in:
- lib/rubocop/cop/minitest/refute_empty.rb
Overview
Enforces to use ‘refute_empty` instead of using `refute(object.empty?)`.
Instance Method Summary collapse
Methods included from RuboCop::Cop::MinitestCopRule
Instance Method Details
#on_send(node) ⇒ Object
23 24 25 26 27 28 29 30 31 |
# File 'lib/rubocop/cop/minitest/refute_empty.rb', line 23 def on_send(node) return unless node.method?(:refute) return unless node.first_argument.respond_to?(:method?) && node.first_argument.method?(:empty?) return unless node.first_argument.arguments.empty? add_offense(node, message: (node.arguments)) do |corrector| autocorrect(corrector, node, node.arguments) end end |