Make Devise::Mailer inherit from ApplicationMailer
This way we remove duplication in the `from:` proc, the helpers, and the methods we're about to write.
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
class DeviseMailer < Devise::Mailer
|
||||
helper :application, :settings, :mailer
|
||||
include Devise::Controllers::UrlHelpers
|
||||
default template_path: "devise/mailer"
|
||||
|
||||
|
||||
@@ -14,11 +14,15 @@ Devise.setup do |config|
|
||||
# Configure the e-mail address which will be shown in Devise::Mailer,
|
||||
# note that it will be overwritten if you use your own mailer class
|
||||
# with default "from" parameter.
|
||||
config.mailer_sender = proc { "'#{Setting["mailer_from_name"]}' <#{Setting["mailer_from_address"]}>" }
|
||||
# We're not setting it here because it's set by the ApplicationMailer class
|
||||
# config.mailer_sender = "please-change-me-at-config-initializers-devise@example.com"
|
||||
|
||||
# Configure the class responsible to send e-mails.
|
||||
config.mailer = "DeviseMailer"
|
||||
|
||||
# Configure the parent class responsible to send e-mails.
|
||||
config.parent_mailer = "ApplicationMailer"
|
||||
|
||||
# ==> ORM configuration
|
||||
# Load and configure the ORM. Supports :active_record (default) and
|
||||
# :mongoid (bson_ext recommended) by default. Other ORMs may be
|
||||
|
||||
@@ -18,7 +18,7 @@ describe DeviseMailer do
|
||||
|
||||
email = DeviseMailer.confirmation_instructions(create(:user), "ABC")
|
||||
|
||||
expect(email).to deliver_from "'New organization' <new@consul.dev>"
|
||||
expect(email).to deliver_from "New organization <new@consul.dev>"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user