Adds helpers for testing email body.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@9086 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang
2012-03-04 13:28:18 +00:00
parent b1d5f42237
commit 3aaf2b9ed0
7 changed files with 38 additions and 18 deletions
+4 -4
View File
@@ -470,7 +470,7 @@ class MailerTest < ActiveSupport::TestCase
assert_equal 1, ActionMailer::Base.deliveries.size
mail = last_email
assert mail.bcc.include?('dlopper@somenet.foo')
assert mail.body.include?('Bug #3: Error 281 when updating a recipe')
assert_mail_body_match 'Bug #3: Error 281 when updating a recipe', mail
assert_equal '1 issue(s) due in the next 42 days', mail.subject
end
@@ -486,7 +486,7 @@ class MailerTest < ActiveSupport::TestCase
assert_equal 1, ActionMailer::Base.deliveries.size
mail = last_email
assert mail.bcc.include?('dlopper@somenet.foo')
assert !mail.body.include?('Closed issue')
assert_mail_body_no_match 'Closed issue', mail
end
end
@@ -497,7 +497,7 @@ class MailerTest < ActiveSupport::TestCase
assert_equal 1, ActionMailer::Base.deliveries.size # No mail for dlopper
mail = last_email
assert mail.bcc.include?('dlopper@somenet.foo')
assert mail.body.include?('Bug #3: Error 281 when updating a recipe')
assert_mail_body_match 'Bug #3: Error 281 when updating a recipe', mail
end
def last_email
@@ -515,7 +515,7 @@ class MailerTest < ActiveSupport::TestCase
user.language = 'fr'
Mailer.deliver_account_activated(user)
mail = last_email
assert mail.body.include?('Votre compte')
assert_mail_body_match 'Votre compte', mail
assert_equal :it, current_language
end
+2 -2
View File
@@ -176,8 +176,8 @@ class RepositoryTest < ActiveSupport::TestCase
assert_not_nil mail
assert mail.subject.starts_with?(
"[#{fixed_issue.project.name} - #{fixed_issue.tracker.name} ##{fixed_issue.id}]")
assert mail.body.include?(
"Status changed from #{old_status} to #{fixed_issue.status}")
assert_mail_body_match(
"Status changed from #{old_status} to #{fixed_issue.status}", mail)
# ignoring commits referencing an issue of another project
assert_equal [], Issue.find(4).changesets