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