class RSpec::Rails::Railtie
def supports_action_mailer_previews?(config)
def supports_action_mailer_previews?(config) # These checks avoid loading `ActionMailer`. Using `defined?` has the # side-effect of the class getting loaded if it is available. This is # problematic because loading `ActionMailer::Base` will cause it to # read the config settings; this is the only time the config is read. # If the config is loaded now, any settings declared in a config block # in an initializer will be ignored. # # If the action mailer railtie has not been loaded then `config` will # not respond to the method. However, we cannot use # `config.action_mailer.respond_to?(:preview_path)` here as it will # always return `true`. config.respond_to?(:action_mailer) && ::Rails::VERSION::STRING > '4.1' end