Setting.protocol = 'https'
journal = Journal.find(3)
- assert Mailer.deliver_issue_edit(journal)
+ assert Mailer.issue_edit(journal).deliver
mail = last_email
assert_not_nil mail
Setting.protocol = 'http'
journal = Journal.find(3)
- assert Mailer.deliver_issue_edit(journal)
+ assert Mailer.issue_edit(journal).deliver
mail = last_email
assert_not_nil mail
Redmine::Utils.relative_url_root = nil
journal = Journal.find(3)
- assert Mailer.deliver_issue_edit(journal)
+ assert Mailer.issue_edit(journal).deliver
mail = last_email
assert_not_nil mail
def test_email_headers
issue = Issue.find(1)
- Mailer.deliver_issue_add(issue)
+ Mailer.issue_add(issue).deliver
mail = last_email
assert_not_nil mail
assert_equal 'OOF', mail.header['X-Auto-Response-Suppress'].to_s
def test_email_headers_should_include_sender
issue = Issue.find(1)
- Mailer.deliver_issue_add(issue)
+ Mailer.issue_add(issue).deliver
mail = last_email
assert_equal issue.author.login, mail.header['X-Redmine-Sender'].to_s
end
def test_plain_text_mail
Setting.plain_text_mail = 1
journal = Journal.find(2)
- Mailer.deliver_issue_edit(journal)
+ Mailer.issue_edit(journal).deliver
mail = last_email
assert_equal "text/plain; charset=UTF-8", mail.content_type
assert_equal 0, mail.parts.size
def test_html_mail
Setting.plain_text_mail = 0
journal = Journal.find(2)
- Mailer.deliver_issue_edit(journal)
+ Mailer.issue_edit(journal).deliver
mail = last_email
assert_equal 2, mail.parts.size
assert mail.encoded.include?('href')
def test_from_header
with_settings :mail_from => 'redmine@example.net' do
- Mailer.deliver_test_email(User.find(1))
+ Mailer.test_email(User.find(1)).deliver
end
mail = last_email
assert_equal 'redmine@example.net', mail.from_addrs.first
def test_from_header_with_phrase
with_settings :mail_from => 'Redmine app <redmine@example.net>' do
- Mailer.deliver_test_email(User.find(1))
+ Mailer.test_email(User.find(1)).deliver
end
mail = last_email
assert_equal 'redmine@example.net', mail.from_addrs.first
user.pref[:no_self_notified] = false
user.pref.save
User.current = user
- Mailer.deliver_news_added(news.reload)
+ Mailer.news_added(news.reload).deliver
assert_equal 1, last_email.bcc.size
# nobody to notify
user.pref.save
User.current = user
ActionMailer::Base.deliveries.clear
- Mailer.deliver_news_added(news.reload)
+ Mailer.news_added(news.reload).deliver
assert ActionMailer::Base.deliveries.empty?
end
def test_issue_add_message_id
issue = Issue.find(1)
- Mailer.deliver_issue_add(issue)
+ Mailer.issue_add(issue).deliver
mail = last_email
assert_equal Mailer.message_id_for(issue), mail.message_id
assert_nil mail.references
def test_issue_edit_message_id
journal = Journal.find(1)
- Mailer.deliver_issue_edit(journal)
+ Mailer.issue_edit(journal).deliver
mail = last_email
assert_equal Mailer.message_id_for(journal), mail.message_id
assert_include Mailer.message_id_for(journal.issue), mail.references
def test_message_posted_message_id
message = Message.find(1)
- Mailer.deliver_message_posted(message)
+ Mailer.message_posted(message).deliver
mail = last_email
assert_equal Mailer.message_id_for(message), mail.message_id
assert_nil mail.references
def test_reply_posted_message_id
message = Message.find(3)
- Mailer.deliver_message_posted(message)
+ Mailer.message_posted(message).deliver
mail = last_email
assert_equal Mailer.message_id_for(message), mail.message_id
assert_include Mailer.message_id_for(message.parent), mail.references
end
should "notify project members" do
- assert Mailer.deliver_issue_add(@issue)
+ assert Mailer.issue_add(@issue).deliver
assert last_email.bcc.include?('dlopper@somenet.foo')
end
should "not notify project members that are not allow to view the issue" do
Role.find(2).remove_permission!(:view_issues)
- assert Mailer.deliver_issue_add(@issue)
+ assert Mailer.issue_add(@issue).deliver
assert !last_email.bcc.include?('dlopper@somenet.foo')
end
user.save
Watcher.create!(:watchable => @issue, :user => user)
- assert Mailer.deliver_issue_add(@issue)
+ assert Mailer.issue_add(@issue).deliver
assert last_email.bcc.include?(user.mail)
end
user = User.find(9)
Watcher.create!(:watchable => @issue, :user => user)
Role.non_member.remove_permission!(:view_issues)
- assert Mailer.deliver_issue_add(@issue)
+ assert Mailer.issue_add(@issue).deliver
assert !last_email.bcc.include?(user.mail)
end
end
issue = Issue.find(1)
valid_languages.each do |lang|
Setting.default_language = lang.to_s
- assert Mailer.deliver_issue_add(issue)
+ assert Mailer.issue_add(issue).deliver
end
end
journal = Journal.find(1)
valid_languages.each do |lang|
Setting.default_language = lang.to_s
- assert Mailer.deliver_issue_edit(journal)
+ assert Mailer.issue_edit(journal).deliver
end
end
document = Document.find(1)
valid_languages.each do |lang|
Setting.default_language = lang.to_s
- assert Mailer.deliver_document_added(document)
+ assert Mailer.document_added(document).deliver
end
end
attachements = [ Attachment.find_by_container_type('Document') ]
valid_languages.each do |lang|
Setting.default_language = lang.to_s
- assert Mailer.deliver_attachments_added(attachements)
+ assert Mailer.attachments_added(attachements).deliver
end
end
def test_version_file_added
attachements = [ Attachment.find_by_container_type('Version') ]
- assert Mailer.deliver_attachments_added(attachements)
+ assert Mailer.attachments_added(attachements).deliver
assert_not_nil last_email.bcc
assert last_email.bcc.any?
assert_select_email do
def test_project_file_added
attachements = [ Attachment.find_by_container_type('Project') ]
- assert Mailer.deliver_attachments_added(attachements)
+ assert Mailer.attachments_added(attachements).deliver
assert_not_nil last_email.bcc
assert last_email.bcc.any?
assert_select_email do
news = News.find(:first)
valid_languages.each do |lang|
Setting.default_language = lang.to_s
- assert Mailer.deliver_news_added(news)
+ assert Mailer.news_added(news).deliver
end
end
comment = Comment.find(2)
valid_languages.each do |lang|
Setting.default_language = lang.to_s
- assert Mailer.deliver_news_comment_added(comment)
+ assert Mailer.news_comment_added(comment).deliver
end
end
recipients = recipients.compact.uniq
valid_languages.each do |lang|
Setting.default_language = lang.to_s
- assert Mailer.deliver_message_posted(message)
+ assert Mailer.message_posted(message).deliver
end
end
valid_languages.each do |lang|
Setting.default_language = lang.to_s
assert_difference 'ActionMailer::Base.deliveries.size' do
- assert Mailer.deliver_wiki_content_added(content)
+ assert Mailer.wiki_content_added(content).deliver
end
end
end
valid_languages.each do |lang|
Setting.default_language = lang.to_s
assert_difference 'ActionMailer::Base.deliveries.size' do
- assert Mailer.deliver_wiki_content_updated(content)
+ assert Mailer.wiki_content_updated(content).deliver
end
end
end
valid_languages.each do |lang|
user.update_attribute :language, lang.to_s
user.reload
- assert Mailer.deliver_account_information(user, 'pAsswORd')
+ assert Mailer.account_information(user, 'pAsswORd').deliver
end
end
valid_languages.each do |lang|
token.user.update_attribute :language, lang.to_s
token.reload
- assert Mailer.deliver_lost_password(token)
+ assert Mailer.lost_password(token).deliver
end
end
token.user.update_attribute :language, lang.to_s
token.reload
ActionMailer::Base.deliveries.clear
- assert Mailer.deliver_register(token)
+ assert Mailer.register(token).deliver
mail = last_email
assert_select_email do
assert_select "a[href=?]",
user = User.find(1)
valid_languages.each do |lang|
user.update_attribute :language, lang.to_s
- assert Mailer.deliver_test_email(user)
+ assert Mailer.test_email(user).deliver
end
end
# Send an email to a french user
user = User.find(1)
user.language = 'fr'
- Mailer.deliver_account_activated(user)
+ Mailer.account_activated(user).deliver
mail = last_email
assert_mail_body_match 'Votre compte', mail
def test_with_deliveries_off
Mailer.with_deliveries false do
- Mailer.deliver_test_email(User.find(1))
+ Mailer.test_email(User.find(1)).deliver
end
assert ActionMailer::Base.deliveries.empty?
# should restore perform_deliveries
def test_layout_should_include_the_emails_header
with_settings :emails_header => "*Header content*" do
- assert Mailer.deliver_test_email(User.find(1))
+ assert Mailer.test_email(User.find(1)).deliver
assert_select_email do
assert_select ".header" do
assert_select "strong", :text => "Header content"