summaryrefslogtreecommitdiffstats
path: root/test/unit
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2007-11-04 10:43:39 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2007-11-04 10:43:39 +0000
commitbd434427e61edbac03d273a308dcfffe72096ae0 (patch)
tree73856165e0c0c2d3581492280a5d44f52b5364bd /test/unit
parent4ded4277c51b8f35dc9eaa031c918e55470a44b5 (diff)
downloadredmine-bd434427e61edbac03d273a308dcfffe72096ae0.tar.gz
redmine-bd434427e61edbac03d273a308dcfffe72096ae0.zip
Mailer:
* added an application setting to specify the application protocol (http or https) used to generate urls * added layouts for text and html emails * no more language specific templates * urls are now generated using UrlWriter * the mailer now uses AdvAttrAccessor code style to set email parameters git-svn-id: http://redmine.rubyforge.org/svn/trunk@877 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/unit')
-rw-r--r--test/unit/mailer_test.rb43
1 files changed, 40 insertions, 3 deletions
diff --git a/test/unit/mailer_test.rb b/test/unit/mailer_test.rb
index d92c5837b..096551ee5 100644
--- a/test/unit/mailer_test.rb
+++ b/test/unit/mailer_test.rb
@@ -18,7 +18,7 @@
require File.dirname(__FILE__) + '/../test_helper'
class MailerTest < Test::Unit::TestCase
- fixtures :projects, :issues, :users, :members, :documents, :attachments, :tokens, :journals, :journal_details, :trackers, :issue_statuses, :enumerations
+ fixtures :projects, :issues, :users, :members, :documents, :attachments, :news, :tokens, :journals, :journal_details, :trackers, :issue_statuses, :enumerations
# test mailer methods for each language
def test_issue_add
@@ -37,18 +37,54 @@ class MailerTest < Test::Unit::TestCase
end
end
- def test_document_add
+ def test_document_added
document = Document.find(1)
GLoc.valid_languages.each do |lang|
Setting.default_language = lang.to_s
assert Mailer.deliver_document_added(document)
end
end
+
+ def test_attachments_added
+ attachements = [ Attachment.find_by_container_type('Document') ]
+ GLoc.valid_languages.each do |lang|
+ Setting.default_language = lang.to_s
+ assert Mailer.deliver_attachments_added(attachements)
+ end
+ end
+
+ def test_news_added
+ news = News.find(:first)
+ GLoc.valid_languages.each do |lang|
+ Setting.default_language = lang.to_s
+ assert Mailer.deliver_news_added(news)
+ end
+ end
+
+ def test_message_posted
+ message = Message.find(:first)
+ recipients = ([message.root] + message.root.children).collect {|m| m.author.mail if m.author}
+ recipients = recipients.compact.uniq
+ GLoc.valid_languages.each do |lang|
+ Setting.default_language = lang.to_s
+ assert Mailer.deliver_message_posted(message, recipients)
+ end
+ end
+
+ def test_account_information
+ user = User.find(:first)
+ GLoc.valid_languages.each do |lang|
+ user.update_attribute :language, lang.to_s
+ user.reload
+ assert Mailer.deliver_account_information(user, 'pAsswORd')
+ end
+ end
def test_lost_password
token = Token.find(2)
GLoc.valid_languages.each do |lang|
token.user.update_attribute :language, lang.to_s
+ token.reload
assert Mailer.deliver_lost_password(token)
end
end
@@ -57,7 +93,8 @@ class MailerTest < Test::Unit::TestCase
token = Token.find(1)
GLoc.valid_languages.each do |lang|
token.user.update_attribute :language, lang.to_s
+ token.reload
assert Mailer.deliver_register(token)
end
end
-end \ No newline at end of file
+end