lib/rubocop/cop/chef/modernize/minitest_handler_usage.rb in cookstyle-6.15.9 vs lib/rubocop/cop/chef/modernize/minitest_handler_usage.rb in cookstyle-6.16.4
- old
+ new
@@ -24,27 +24,24 @@
# @example
#
# # bad
# depends 'minitest-handler'
#
- class MinitestHandlerUsage < Cop
+ class MinitestHandlerUsage < Base
+ extend AutoCorrector
include RangeHelp
MSG = 'Use Chef InSpec for testing instead of the Minitest Handler cookbook pattern.'
def_node_matcher :minitest_depends?, <<-PATTERN
(send nil? :depends (str "minitest-handler"))
PATTERN
def on_send(node)
minitest_depends?(node) do
- add_offense(node, location: :expression, message: MSG, severity: :refactor)
- end
- end
-
- def autocorrect(node)
- lambda do |corrector|
- corrector.remove(range_with_surrounding_space(range: node.loc.expression, side: :left))
+ add_offense(node, message: MSG, severity: :refactor) do |corrector|
+ corrector.remove(range_with_surrounding_space(range: node.loc.expression, side: :left))
+ end
end
end
end
end
end