Adds a test for not sending email without recipient (#4920).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@3518 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
8e57b1f6cd
commit
ae55978515
|
@ -135,6 +135,27 @@ class MailerTest < ActiveSupport::TestCase
|
|||
assert_equal 'Redmine app', mail.from_addrs.first.name
|
||||
end
|
||||
|
||||
def test_should_not_send_email_without_recipient
|
||||
news = News.find(:first)
|
||||
user = news.author
|
||||
# Remove members except news author
|
||||
news.project.memberships.each {|m| m.destroy unless m.user == user}
|
||||
|
||||
user.pref[:no_self_notified] = false
|
||||
user.pref.save
|
||||
User.current = user
|
||||
Mailer.deliver_news_added(news.reload)
|
||||
assert_equal 1, last_email.bcc.size
|
||||
|
||||
# nobody to notify
|
||||
user.pref[:no_self_notified] = true
|
||||
user.pref.save
|
||||
User.current = user
|
||||
ActionMailer::Base.deliveries.clear
|
||||
Mailer.deliver_news_added(news.reload)
|
||||
assert ActionMailer::Base.deliveries.empty?
|
||||
end
|
||||
|
||||
def test_issue_add_message_id
|
||||
issue = Issue.find(1)
|
||||
Mailer.deliver_issue_add(issue)
|
||||
|
|
Loading…
Reference in New Issue