Sha256: cc97c6ef98e6c4b4bf27b4a7d6ee5b96cb9d132fd55d86d0004881c78efc7e53
Contents?: true
Size: 941 Bytes
Versions: 9
Compression:
Stored size: 941 Bytes
Contents
# frozen_string_literal: true module RuboCop module Cop module Salsify # Check that mailers subclass ApplicationMailer with Rails 5.0. # # @example # # # good # class Tesla < ApplicationMailer # ... # end # # # bad # class Yugo < ActionMailer::Base # ... # end class RailsApplicationMailer < RuboCop::Cop::Base extend TargetRailsVersion extend RuboCop::Cop::AutoCorrector minimum_target_rails_version 5.0 MSG = 'Mailers should subclass `ApplicationMailer`.' SUPERCLASS = 'ApplicationMailer' BASE_PATTERN = '(const (const nil? :ActionMailer) :Base)' include RuboCop::Cop::EnforceSuperclass def autocorrect(node) lambda do |corrector| corrector.replace(node.source_range, self.class::SUPERCLASS) end end end end end end
Version data entries
9 entries across 9 versions & 1 rubygems