Sha256: 1f4ce858e285ffbb40e1fe20686bc0caed446d66a5b449e2c0b212ffbf56472d
Contents?: true
Size: 883 Bytes
Versions: 7
Compression:
Stored size: 883 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 < Cop extend TargetRailsVersion 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
7 entries across 7 versions & 1 rubygems