Mercurial > hg > soundsoftware-site
diff test/unit/mailer_test.rb @ 524:1248a47e81b3 feature_36
Merge from branch "luisf"
author | luisf <luis.figueira@eecs.qmul.ac.uk> |
---|---|
date | Mon, 25 Jul 2011 14:39:38 +0100 |
parents | cbce1fd3b1b7 |
children | cbb26bc654de |
line wrap: on
line diff
--- a/test/unit/mailer_test.rb Fri Jul 15 17:21:05 2011 +0100 +++ b/test/unit/mailer_test.rb Mon Jul 25 14:39:38 2011 +0100 @@ -1,5 +1,5 @@ -# redMine - project management software -# Copyright (C) 2006-2007 Jean-Philippe Lang +# Redmine - project management software +# Copyright (C) 2006-2011 Jean-Philippe Lang # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -15,17 +15,18 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -require File.dirname(__FILE__) + '/../test_helper' +require File.expand_path('../../test_helper', __FILE__) class MailerTest < ActiveSupport::TestCase include Redmine::I18n include ActionController::Assertions::SelectorAssertions - fixtures :projects, :enabled_modules, :issues, :users, :members, :member_roles, :roles, :documents, :attachments, :news, :tokens, :journals, :journal_details, :changesets, :trackers, :issue_statuses, :enumerations, :messages, :boards, :repositories + fixtures :all def setup ActionMailer::Base.deliveries.clear Setting.host_name = 'mydomain.foo' Setting.protocol = 'http' + Setting.plain_text_mail = '0' end def test_generated_links_in_emails @@ -278,6 +279,9 @@ assert Mailer.deliver_attachments_added(attachements) assert_not_nil last_email.bcc assert last_email.bcc.any? + assert_select_email do + assert_select "a[href=?]", "http://mydomain.foo/projects/ecookbook/files" + end end def test_project_file_added @@ -285,6 +289,9 @@ assert Mailer.deliver_attachments_added(attachements) assert_not_nil last_email.bcc assert last_email.bcc.any? + assert_select_email do + assert_select "a[href=?]", "http://mydomain.foo/projects/ecookbook/files" + end end def test_news_added @@ -295,6 +302,14 @@ end end + def test_news_comment_added + comment = Comment.find(2) + valid_languages.each do |lang| + Setting.default_language = lang.to_s + assert Mailer.deliver_news_comment_added(comment) + end + end + def test_message_posted message = Message.find(:first) recipients = ([message.root] + message.root.children).collect {|m| m.author.mail if m.author} @@ -305,6 +320,26 @@ end end + def test_wiki_content_added + content = WikiContent.find(:first) + 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) + end + end + end + + def test_wiki_content_updated + content = WikiContent.find(:first) + 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) + end + end + end + def test_account_information user = User.find(2) valid_languages.each do |lang| @@ -405,9 +440,6 @@ end end end - end - end - end