-
Notifications
You must be signed in to change notification settings - Fork 993
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixes #9873 - generate unique alert mails for each user group member
To create distinct mails, new Mailer instances are required instead of using the same one - else, the last message changes the previous ones. The recipient list is now determined in the ReportImporter, and the MailNotification helps create Mailers for each recipient. The locale is also set correctly for each recipient this way, ensuring their subject lines are now also translated.
- Loading branch information
Dominic Cleal
committed
May 5, 2015
1 parent
83bd400
commit 65ad333
Showing
10 changed files
with
120 additions
and
74 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,21 @@ | ||
require 'test_helper' | ||
|
||
class ApplicationMailerTest < ActiveSupport::TestCase | ||
setup do | ||
ActionMailer::Base.deliveries = [] | ||
Setting[:email_subject_prefix] = '[foreman-production]' | ||
setup { ActionMailer::Base.deliveries = [] } | ||
|
||
def mail | ||
ApplicationMailer.mail(:to => '[email protected]', :subject => 'Danger, Will Robinson!') do |mail| | ||
format.text "This is a test mail." | ||
end.deliver | ||
|
||
@mail = ActionMailer::Base.deliveries.first | ||
ActionMailer::Base.deliveries.last | ||
end | ||
|
||
test "foreman server header is set" do | ||
assert_equal @mail.header['X-Foreman-Server'].to_s, 'foreman.some.host.fqdn' | ||
assert_equal mail.header['X-Foreman-Server'].to_s, 'foreman.some.host.fqdn' | ||
end | ||
|
||
test "foreman subject prefix is attached" do | ||
assert_match /^\[foreman-production\]/, @mail.subject | ||
Setting[:email_subject_prefix] = '[foreman-production]' | ||
assert_match /^\[foreman-production\]/, mail.subject | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters