comparison test/unit/.svn/text-base/mailer_test.rb.svn-base @ 441:cbce1fd3b1b7 redmine-1.2

Update to Redmine 1.2-stable branch (Redmine SVN rev 6000)
author Chris Cannam
date Mon, 06 Jun 2011 14:24:13 +0100
parents 8661b858af72
children
comparison
equal deleted inserted replaced
245:051f544170fe 441:cbce1fd3b1b7
1 # redMine - project management software 1 # Redmine - project management software
2 # Copyright (C) 2006-2007 Jean-Philippe Lang 2 # Copyright (C) 2006-2011 Jean-Philippe Lang
3 # 3 #
4 # This program is free software; you can redistribute it and/or 4 # This program is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU General Public License 5 # modify it under the terms of the GNU General Public License
6 # as published by the Free Software Foundation; either version 2 6 # as published by the Free Software Foundation; either version 2
7 # of the License, or (at your option) any later version. 7 # of the License, or (at your option) any later version.
18 require File.expand_path('../../test_helper', __FILE__) 18 require File.expand_path('../../test_helper', __FILE__)
19 19
20 class MailerTest < ActiveSupport::TestCase 20 class MailerTest < ActiveSupport::TestCase
21 include Redmine::I18n 21 include Redmine::I18n
22 include ActionController::Assertions::SelectorAssertions 22 include ActionController::Assertions::SelectorAssertions
23 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 23 fixtures :all
24 24
25 def setup 25 def setup
26 ActionMailer::Base.deliveries.clear 26 ActionMailer::Base.deliveries.clear
27 Setting.host_name = 'mydomain.foo' 27 Setting.host_name = 'mydomain.foo'
28 Setting.protocol = 'http' 28 Setting.protocol = 'http'
29 Setting.plain_text_mail = '0'
29 end 30 end
30 31
31 def test_generated_links_in_emails 32 def test_generated_links_in_emails
32 Setting.host_name = 'mydomain.foo' 33 Setting.host_name = 'mydomain.foo'
33 Setting.protocol = 'https' 34 Setting.protocol = 'https'
276 def test_version_file_added 277 def test_version_file_added
277 attachements = [ Attachment.find_by_container_type('Version') ] 278 attachements = [ Attachment.find_by_container_type('Version') ]
278 assert Mailer.deliver_attachments_added(attachements) 279 assert Mailer.deliver_attachments_added(attachements)
279 assert_not_nil last_email.bcc 280 assert_not_nil last_email.bcc
280 assert last_email.bcc.any? 281 assert last_email.bcc.any?
282 assert_select_email do
283 assert_select "a[href=?]", "http://mydomain.foo/projects/ecookbook/files"
284 end
281 end 285 end
282 286
283 def test_project_file_added 287 def test_project_file_added
284 attachements = [ Attachment.find_by_container_type('Project') ] 288 attachements = [ Attachment.find_by_container_type('Project') ]
285 assert Mailer.deliver_attachments_added(attachements) 289 assert Mailer.deliver_attachments_added(attachements)
286 assert_not_nil last_email.bcc 290 assert_not_nil last_email.bcc
287 assert last_email.bcc.any? 291 assert last_email.bcc.any?
292 assert_select_email do
293 assert_select "a[href=?]", "http://mydomain.foo/projects/ecookbook/files"
294 end
288 end 295 end
289 296
290 def test_news_added 297 def test_news_added
291 news = News.find(:first) 298 news = News.find(:first)
292 valid_languages.each do |lang| 299 valid_languages.each do |lang|
293 Setting.default_language = lang.to_s 300 Setting.default_language = lang.to_s
294 assert Mailer.deliver_news_added(news) 301 assert Mailer.deliver_news_added(news)
302 end
303 end
304
305 def test_news_comment_added
306 comment = Comment.find(2)
307 valid_languages.each do |lang|
308 Setting.default_language = lang.to_s
309 assert Mailer.deliver_news_comment_added(comment)
295 end 310 end
296 end 311 end
297 312
298 def test_message_posted 313 def test_message_posted
299 message = Message.find(:first) 314 message = Message.find(:first)
423 assert_select ".header" do 438 assert_select ".header" do
424 assert_select "strong", :text => "Header content" 439 assert_select "strong", :text => "Header content"
425 end 440 end
426 end 441 end
427 end 442 end
428 443 end
429 end 444 end
430
431 end
432
433 end 445 end