summaryrefslogtreecommitdiffstats
path: root/test/unit/mailer_test.rb
diff options
context:
space:
mode:
authorToshi MARUYAMA <marutosijp2@yahoo.co.jp>2012-05-05 13:07:12 +0000
committerToshi MARUYAMA <marutosijp2@yahoo.co.jp>2012-05-05 13:07:12 +0000
commit7af8d7caf06416a1d9b94f061a6d0b28fc6bc2d9 (patch)
tree740ef4bf2bd455d4730e086dc8908515e1b0ad96 /test/unit/mailer_test.rb
parente876d1bfc014a51ce5e1178bc57529c37c517c45 (diff)
downloadredmine-7af8d7caf06416a1d9b94f061a6d0b28fc6bc2d9.tar.gz
redmine-7af8d7caf06416a1d9b94f061a6d0b28fc6bc2d9.zip
replace Mailer deliver syntax to Rails3 style
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@9638 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/unit/mailer_test.rb')
-rw-r--r--test/unit/mailer_test.rb74
1 files changed, 37 insertions, 37 deletions
diff --git a/test/unit/mailer_test.rb b/test/unit/mailer_test.rb
index d9daec7a7..483886e58 100644
--- a/test/unit/mailer_test.rb
+++ b/test/unit/mailer_test.rb
@@ -42,7 +42,7 @@ class MailerTest < ActiveSupport::TestCase
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
@@ -81,7 +81,7 @@ class MailerTest < ActiveSupport::TestCase
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
@@ -121,7 +121,7 @@ class MailerTest < ActiveSupport::TestCase
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
@@ -158,7 +158,7 @@ class MailerTest < ActiveSupport::TestCase
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
@@ -167,7 +167,7 @@ class MailerTest < ActiveSupport::TestCase
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
@@ -175,7 +175,7 @@ class MailerTest < ActiveSupport::TestCase
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
@@ -185,7 +185,7 @@ class MailerTest < ActiveSupport::TestCase
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')
@@ -193,7 +193,7 @@ class MailerTest < ActiveSupport::TestCase
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
@@ -201,7 +201,7 @@ class MailerTest < ActiveSupport::TestCase
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
@@ -217,7 +217,7 @@ class MailerTest < ActiveSupport::TestCase
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
@@ -225,13 +225,13 @@ class MailerTest < ActiveSupport::TestCase
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
@@ -239,7 +239,7 @@ class MailerTest < ActiveSupport::TestCase
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
@@ -252,7 +252,7 @@ class MailerTest < ActiveSupport::TestCase
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
@@ -266,7 +266,7 @@ class MailerTest < ActiveSupport::TestCase
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
@@ -286,13 +286,13 @@ class MailerTest < ActiveSupport::TestCase
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
@@ -305,7 +305,7 @@ class MailerTest < ActiveSupport::TestCase
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
@@ -313,7 +313,7 @@ class MailerTest < ActiveSupport::TestCase
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
@@ -323,7 +323,7 @@ class MailerTest < ActiveSupport::TestCase
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
@@ -331,7 +331,7 @@ class MailerTest < ActiveSupport::TestCase
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
@@ -339,7 +339,7 @@ class MailerTest < ActiveSupport::TestCase
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
@@ -347,13 +347,13 @@ class MailerTest < ActiveSupport::TestCase
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
@@ -363,7 +363,7 @@ class MailerTest < ActiveSupport::TestCase
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
@@ -375,7 +375,7 @@ class MailerTest < ActiveSupport::TestCase
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
@@ -383,7 +383,7 @@ class MailerTest < ActiveSupport::TestCase
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
@@ -393,7 +393,7 @@ class MailerTest < ActiveSupport::TestCase
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
@@ -402,7 +402,7 @@ class MailerTest < ActiveSupport::TestCase
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
@@ -412,7 +412,7 @@ class MailerTest < ActiveSupport::TestCase
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
@@ -422,7 +422,7 @@ class MailerTest < ActiveSupport::TestCase
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
@@ -431,7 +431,7 @@ class MailerTest < ActiveSupport::TestCase
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
@@ -444,7 +444,7 @@ class MailerTest < ActiveSupport::TestCase
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=?]",
@@ -458,7 +458,7 @@ class MailerTest < ActiveSupport::TestCase
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
@@ -504,7 +504,7 @@ class MailerTest < ActiveSupport::TestCase
# 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
@@ -513,7 +513,7 @@ class MailerTest < ActiveSupport::TestCase
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
@@ -522,7 +522,7 @@ class MailerTest < ActiveSupport::TestCase
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"