class RuboCop::Cop::Chef::Correctness::InvalidNotificationTiming

Valid notification timings are `:immediately`, `:immediate` (alias for :immediately), `:delayed`, and `:before`.

@example

#### incorrect

template '/etc/www/configures-apache.conf' do
  notifies :restart, 'service[apache]', :nope
end

#### correct

template '/etc/www/configures-apache.conf' do
  notifies :restart, 'service[apache]', :immediately
end

Constants

MSG
RESTRICT_ON_SEND

Public Instance Methods

on_send(node) click to toggle source
# File lib/rubocop/cop/chef/correctness/invalid_notification_timing.rb, line 46
def on_send(node)
  notification_with_timing?(node) do |timing|
    add_offense(timing, message: MSG, severity: :refactor) unless %i(immediate immediately delayed before).include?(timing.value)
  end
end