class ChefSpec::Matchers::NotificationsMatcher

def matches?(resource)

def matches?(resource)
  @resource = resource
  if @resource
    block = Proc.new do |notified|
      resource_name(notified.resource).to_s == @expected_resource_type &&
        (@expected_resource_name === notified.resource.identity.to_s || @expected_resource_name === notified.resource.name.to_s) &&
        matches_action?(notified)
    end
    if @immediately
      immediate_notifications.any?(&block)
    elsif @delayed
      delayed_notifications.any?(&block)
    elsif @before
      before_notifications.any?(&block)
    else
      all_notifications.any?(&block)
    end
  end
end