Class: RuboCop::Cop::Chef::ChefModernize::MinitestHandlerUsage

Inherits:
RuboCop::Cop
  • Object
show all
Defined in:
lib/rubocop/cop/chef/modernize/minitest_handler_usage.rb

Overview

Use Chef InSpec for testing instead of the Minitest Handler cookbook pattern.

Examples:


# bad
depends 'minitest-handler'

Constant Summary collapse

MSG =
'Use Chef InSpec for testing instead of the Minitest Handler cookbook pattern.'.freeze

Instance Method Summary collapse

Instance Method Details

#autocorrect(node) ⇒ Object



41
42
43
44
45
# File 'lib/rubocop/cop/chef/modernize/minitest_handler_usage.rb', line 41

def autocorrect(node)
  lambda do |corrector|
    corrector.remove(node.loc.expression)
  end
end

#on_send(node) ⇒ Object



35
36
37
38
39
# File 'lib/rubocop/cop/chef/modernize/minitest_handler_usage.rb', line 35

def on_send(node)
  minitest_depends?(node) do
    add_offense(node, location: :expression, message: MSG, severity: :refactor)
  end
end