@@ -31,20 +31,16 class MailerTest < ActiveSupport::TestCase | |||||
31 |
|
31 | |||
32 | def setup |
|
32 | def setup | |
33 | ActionMailer::Base.deliveries.clear |
|
33 | ActionMailer::Base.deliveries.clear | |
34 | Setting.host_name = 'mydomain.foo' |
|
|||
35 | Setting.protocol = 'http' |
|
|||
36 | Setting.plain_text_mail = '0' |
|
34 | Setting.plain_text_mail = '0' | |
37 | Setting.default_language = 'en' |
|
35 | Setting.default_language = 'en' | |
38 | User.current = nil |
|
36 | User.current = nil | |
39 | end |
|
37 | end | |
40 |
|
38 | |||
41 | def test_generated_links_in_emails |
|
39 | def test_generated_links_in_emails | |
42 |
|
|
40 | with_settings :host_name => 'mydomain.foo', :protocol => 'https' do | |
43 | Setting.protocol = 'https' |
|
41 | journal = Journal.find(3) | |
44 |
|
42 | assert Mailer.deliver_issue_edit(journal) | ||
45 | journal = Journal.find(3) |
|
43 | end | |
46 | assert Mailer.deliver_issue_edit(journal) |
|
|||
47 |
|
||||
48 | mail = last_email |
|
44 | mail = last_email | |
49 | assert_not_nil mail |
|
45 | assert_not_nil mail | |
50 |
|
46 | |||
@@ -80,11 +76,10 class MailerTest < ActiveSupport::TestCase | |||||
80 |
|
76 | |||
81 | def test_generated_links_with_prefix |
|
77 | def test_generated_links_with_prefix | |
82 | relative_url_root = Redmine::Utils.relative_url_root |
|
78 | relative_url_root = Redmine::Utils.relative_url_root | |
83 |
|
|
79 | with_settings :host_name => 'mydomain.foo/rdm', :protocol => 'http' do | |
84 | Setting.protocol = 'http' |
|
80 | journal = Journal.find(3) | |
85 |
|
81 | assert Mailer.deliver_issue_edit(journal) | ||
86 | journal = Journal.find(3) |
|
82 | end | |
87 | assert Mailer.deliver_issue_edit(journal) |
|
|||
88 |
|
83 | |||
89 | mail = last_email |
|
84 | mail = last_email | |
90 | assert_not_nil mail |
|
85 | assert_not_nil mail | |
@@ -143,18 +138,18 class MailerTest < ActiveSupport::TestCase | |||||
143 | Mailer.deliver_issue_edit(journal) |
|
138 | Mailer.deliver_issue_edit(journal) | |
144 | assert_not_nil last_email |
|
139 | assert_not_nil last_email | |
145 | assert_select_email do |
|
140 | assert_select_email do | |
146 |
assert_select 'a[href=?]', 'http:// |
|
141 | assert_select 'a[href=?]', 'http://localhost:3000/issues/2', :text => 'Feature request #2' | |
147 | end |
|
142 | end | |
148 | end |
|
143 | end | |
149 |
|
144 | |||
150 | def test_generated_links_with_prefix_and_no_relative_url_root |
|
145 | def test_generated_links_with_prefix_and_no_relative_url_root | |
151 | relative_url_root = Redmine::Utils.relative_url_root |
|
146 | relative_url_root = Redmine::Utils.relative_url_root | |
152 | Setting.host_name = 'mydomain.foo/rdm' |
|
|||
153 | Setting.protocol = 'http' |
|
|||
154 | Redmine::Utils.relative_url_root = nil |
|
147 | Redmine::Utils.relative_url_root = nil | |
155 |
|
148 | |||
156 | journal = Journal.find(3) |
|
149 | with_settings :host_name => 'mydomain.foo/rdm', :protocol => 'http' do | |
157 | assert Mailer.deliver_issue_edit(journal) |
|
150 | journal = Journal.find(3) | |
|
151 | assert Mailer.deliver_issue_edit(journal) | |||
|
152 | end | |||
158 |
|
153 | |||
159 | mail = last_email |
|
154 | mail = last_email | |
160 | assert_not_nil mail |
|
155 | assert_not_nil mail | |
@@ -285,7 +280,7 class MailerTest < ActiveSupport::TestCase | |||||
285 | assert_select_email do |
|
280 | assert_select_email do | |
286 | # link to the update |
|
281 | # link to the update | |
287 | assert_select "a[href=?]", |
|
282 | assert_select "a[href=?]", | |
288 |
"http:// |
|
283 | "http://localhost:3000/issues/#{journal.journalized_id}#change-#{journal.id}" | |
289 | end |
|
284 | end | |
290 | end |
|
285 | end | |
291 |
|
286 | |||
@@ -298,7 +293,7 class MailerTest < ActiveSupport::TestCase | |||||
298 | assert_select_email do |
|
293 | assert_select_email do | |
299 | # link to the message |
|
294 | # link to the message | |
300 | assert_select "a[href=?]", |
|
295 | assert_select "a[href=?]", | |
301 |
"http:// |
|
296 | "http://localhost:3000/boards/#{message.board.id}/topics/#{message.id}", | |
302 | :text => message.subject |
|
297 | :text => message.subject | |
303 | end |
|
298 | end | |
304 | end |
|
299 | end | |
@@ -312,7 +307,7 class MailerTest < ActiveSupport::TestCase | |||||
312 | assert_select_email do |
|
307 | assert_select_email do | |
313 | # link to the reply |
|
308 | # link to the reply | |
314 | assert_select "a[href=?]", |
|
309 | assert_select "a[href=?]", | |
315 |
"http:// |
|
310 | "http://localhost:3000/boards/#{message.board.id}/topics/#{message.root.id}?r=#{message.id}#message-#{message.id}", | |
316 | :text => message.subject |
|
311 | :text => message.subject | |
317 | end |
|
312 | end | |
318 | end |
|
313 | end | |
@@ -474,7 +469,7 class MailerTest < ActiveSupport::TestCase | |||||
474 | assert_not_nil last_email.bcc |
|
469 | assert_not_nil last_email.bcc | |
475 | assert last_email.bcc.any? |
|
470 | assert last_email.bcc.any? | |
476 | assert_select_email do |
|
471 | assert_select_email do | |
477 |
assert_select "a[href=?]", "http:// |
|
472 | assert_select "a[href=?]", "http://localhost:3000/projects/ecookbook/files" | |
478 | end |
|
473 | end | |
479 | end |
|
474 | end | |
480 |
|
475 | |||
@@ -484,7 +479,7 class MailerTest < ActiveSupport::TestCase | |||||
484 | assert_not_nil last_email.bcc |
|
479 | assert_not_nil last_email.bcc | |
485 | assert last_email.bcc.any? |
|
480 | assert last_email.bcc.any? | |
486 | assert_select_email do |
|
481 | assert_select_email do | |
487 |
assert_select "a[href=?]", "http:// |
|
482 | assert_select "a[href=?]", "http://localhost:3000/projects/ecookbook/files" | |
488 | end |
|
483 | end | |
489 | end |
|
484 | end | |
490 |
|
485 | |||
@@ -529,7 +524,7 class MailerTest < ActiveSupport::TestCase | |||||
529 | assert Mailer.wiki_content_added(content).deliver |
|
524 | assert Mailer.wiki_content_added(content).deliver | |
530 | assert_select_email do |
|
525 | assert_select_email do | |
531 | assert_select 'a[href=?]', |
|
526 | assert_select 'a[href=?]', | |
532 |
'http:// |
|
527 | 'http://localhost:3000/projects/ecookbook/wiki/CookBook_documentation', | |
533 | :text => 'CookBook documentation' |
|
528 | :text => 'CookBook documentation' | |
534 | end |
|
529 | end | |
535 | end |
|
530 | end | |
@@ -543,7 +538,7 class MailerTest < ActiveSupport::TestCase | |||||
543 | assert Mailer.wiki_content_updated(content).deliver |
|
538 | assert Mailer.wiki_content_updated(content).deliver | |
544 | assert_select_email do |
|
539 | assert_select_email do | |
545 | assert_select 'a[href=?]', |
|
540 | assert_select 'a[href=?]', | |
546 |
'http:// |
|
541 | 'http://localhost:3000/projects/ecookbook/wiki/CookBook_documentation', | |
547 | :text => 'CookBook documentation' |
|
542 | :text => 'CookBook documentation' | |
548 | end |
|
543 | end | |
549 | end |
|
544 | end | |
@@ -570,9 +565,6 class MailerTest < ActiveSupport::TestCase | |||||
570 |
|
565 | |||
571 | def test_register |
|
566 | def test_register | |
572 | token = Token.find(1) |
|
567 | token = Token.find(1) | |
573 | Setting.host_name = 'redmine.foo' |
|
|||
574 | Setting.protocol = 'https' |
|
|||
575 |
|
||||
576 | valid_languages.each do |lang| |
|
568 | valid_languages.each do |lang| | |
577 | token.user.update_attribute :language, lang.to_s |
|
569 | token.user.update_attribute :language, lang.to_s | |
578 | token.reload |
|
570 | token.reload | |
@@ -581,8 +573,8 class MailerTest < ActiveSupport::TestCase | |||||
581 | mail = last_email |
|
573 | mail = last_email | |
582 | assert_select_email do |
|
574 | assert_select_email do | |
583 | assert_select "a[href=?]", |
|
575 | assert_select "a[href=?]", | |
584 |
"http |
|
576 | "http://localhost:3000/account/activate?token=#{token.value}", | |
585 |
:text => "http |
|
577 | :text => "http://localhost:3000/account/activate?token=#{token.value}" | |
586 | end |
|
578 | end | |
587 | end |
|
579 | end | |
588 | end |
|
580 | end | |
@@ -706,7 +698,7 class MailerTest < ActiveSupport::TestCase | |||||
706 | ).deliver |
|
698 | ).deliver | |
707 | assert_select_email do |
|
699 | assert_select_email do | |
708 | assert_select "h1", false |
|
700 | assert_select "h1", false | |
709 |
assert_select 'a[href=?]', 'http:// |
|
701 | assert_select 'a[href=?]', 'http://localhost:3000/my/account', :text => I18n.t(:label_my_account) | |
710 | end |
|
702 | end | |
711 | end |
|
703 | end | |
712 | end |
|
704 | end |
General Comments 0
You need to be logged in to leave comments.
Login now