Class: RuboCop::Cop::Salsify::RailsApplicationMailer

Inherits:
RuboCop::Cop
  • Object
show all
Extended by:
TargetRailsVersion
Includes:
EnforceSuperclass
Defined in:
lib/rubocop/cop/salsify/rails_application_mailer.rb

Overview

Check that mailers subclass ApplicationMailer with Rails 5.0.

Examples:


# good
class Tesla < ApplicationMailer
  ...
end

# bad
class Yugo < ActionMailer::Base
  ...
end

Constant Summary collapse

MSG =
'Mailers should subclass `ApplicationMailer`.'
SUPERCLASS =
'ApplicationMailer'
BASE_PATTERN =
'(const (const nil? :ActionMailer) :Base)'

Instance Method Summary collapse

Instance Method Details

#autocorrect(node) ⇒ Object


30
31
32
33
34
# File 'lib/rubocop/cop/salsify/rails_application_mailer.rb', line 30

def autocorrect(node)
  lambda do |corrector|
    corrector.replace(node.source_range, self.class::SUPERCLASS)
  end
end