Class: RuboCop::Cop::Chef::ChefDeprecations::ChefSpecLegacyRunner
- Inherits:
-
RuboCop::Cop
- Object
- RuboCop::Cop
- RuboCop::Cop::Chef::ChefDeprecations::ChefSpecLegacyRunner
- Defined in:
- lib/rubocop/cop/chef/deprecation/chefspec_legacy_runner.rb
Overview
Use ChefSpec::SoloRunner or ChefSpec::ServerRunner instead of the deprecated ChefSpec::Runner. These new runners were introduced in ChefSpec 4.1 (Oct 2014).
Constant Summary collapse
- MSG =
'Use ChefSpec::SoloRunner or ChefSpec::ServerRunner instead of the deprecated ChefSpec::Runner.'.freeze
Instance Method Summary collapse
Instance Method Details
#autocorrect(node) ⇒ Object
55 56 57 58 59 |
# File 'lib/rubocop/cop/chef/deprecation/chefspec_legacy_runner.rb', line 55 def autocorrect(node) lambda do |corrector| corrector.replace(node.loc.expression, 'ChefSpec::ServerRunner') end end |
#on_const(node) ⇒ Object
49 50 51 52 53 |
# File 'lib/rubocop/cop/chef/deprecation/chefspec_legacy_runner.rb', line 49 def on_const(node) chefspec_runner?(node) do add_offense(node, location: :expression, message: MSG, severity: :refactor) end end |