@@ -135,7 +135,7 RAW | |||||
135 |
|
135 | |||
136 | def test_redmine_links |
|
136 | def test_redmine_links | |
137 | issue_link = link_to('#3', {:controller => 'issues', :action => 'show', :id => 3}, |
|
137 | issue_link = link_to('#3', {:controller => 'issues', :action => 'show', :id => 3}, | |
138 | :class => 'issue', :title => 'Error 281 when updating a recipe (New)') |
|
138 | :class => 'issue status-1 priority-1 overdue', :title => 'Error 281 when updating a recipe (New)') | |
139 |
|
139 | |||
140 | changeset_link = link_to('r1', {:controller => 'repositories', :action => 'revision', :id => 'ecookbook', :rev => 1}, |
|
140 | changeset_link = link_to('r1', {:controller => 'repositories', :action => 'revision', :id => 'ecookbook', :rev => 1}, | |
141 | :class => 'changeset', :title => 'My very first commit') |
|
141 | :class => 'changeset', :title => 'My very first commit') |
@@ -19,6 +19,7 require File.dirname(__FILE__) + '/../test_helper' | |||||
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 | fixtures :projects, :issues, :users, :members, :member_roles, :documents, :attachments, :news, :tokens, :journals, :journal_details, :changesets, :trackers, :issue_statuses, :enumerations, :messages, :boards, :repositories |
|
23 | fixtures :projects, :issues, :users, :members, :member_roles, :documents, :attachments, :news, :tokens, :journals, :journal_details, :changesets, :trackers, :issue_statuses, :enumerations, :messages, :boards, :repositories | |
23 |
|
24 | |||
24 | def test_generated_links_in_emails |
|
25 | def test_generated_links_in_emails | |
@@ -31,13 +32,15 class MailerTest < ActiveSupport::TestCase | |||||
31 |
|
32 | |||
32 | mail = ActionMailer::Base.deliveries.last |
|
33 | mail = ActionMailer::Base.deliveries.last | |
33 | assert_kind_of TMail::Mail, mail |
|
34 | assert_kind_of TMail::Mail, mail | |
34 | # link to the main ticket |
|
|||
35 | assert mail.body.include?('<a href="https://mydomain.foo/issues/1">Bug #1: Can\'t print recipes</a>') |
|
|||
36 |
|
35 | |||
37 | # link to a referenced ticket |
|
36 | assert_select_email do | |
38 | assert mail.body.include?('<a href="https://mydomain.foo/issues/2" class="issue" title="Add ingredients categories (Assigned)">#2</a>') |
|
37 | # link to the main ticket | |
39 | # link to a changeset |
|
38 | assert_select "a[href=?]", "https://mydomain.foo/issues/1", :text => "Bug #1: Can't print recipes" | |
40 | assert mail.body.include?('<a href="https://mydomain.foo/projects/ecookbook/repository/revisions/2" class="changeset" title="This commit fixes #1, #2 and references #1 & #3">r2</a>') |
|
39 | # link to a referenced ticket | |
|
40 | assert_select "a[href=?][title=?]", "https://mydomain.foo/issues/2", "Add ingredients categories (Assigned)", :text => "#2" | |||
|
41 | # link to a changeset | |||
|
42 | assert_select "a[href=?][title=?]", "https://mydomain.foo/projects/ecookbook/repository/revisions/2", "This commit fixes #1, #2 and references #1 & #3", :text => "r2" | |||
|
43 | end | |||
41 | end |
|
44 | end | |
42 |
|
45 | |||
43 | def test_generated_links_with_prefix |
|
46 | def test_generated_links_with_prefix | |
@@ -52,13 +55,15 class MailerTest < ActiveSupport::TestCase | |||||
52 |
|
55 | |||
53 | mail = ActionMailer::Base.deliveries.last |
|
56 | mail = ActionMailer::Base.deliveries.last | |
54 | assert_kind_of TMail::Mail, mail |
|
57 | assert_kind_of TMail::Mail, mail | |
55 | # link to the main ticket |
|
58 | ||
56 | assert mail.body.include?('<a href="http://mydomain.foo/rdm/issues/1">Bug #1: Can\'t print recipes</a>') |
|
59 | assert_select_email do | |
57 |
|
60 | # link to the main ticket | ||
58 | # link to a referenced ticket |
|
61 | assert_select "a[href=?]", "http://mydomain.foo/rdm/issues/1", :text => "Bug #1: Can't print recipes" | |
59 | assert mail.body.include?('<a href="http://mydomain.foo/rdm/issues/2" class="issue" title="Add ingredients categories (Assigned)">#2</a>') |
|
62 | # link to a referenced ticket | |
60 | # link to a changeset |
|
63 | assert_select "a[href=?][title=?]", "http://mydomain.foo/rdm/issues/2", "Add ingredients categories (Assigned)", :text => "#2" | |
61 | assert mail.body.include?('<a href="http://mydomain.foo/rdm/projects/ecookbook/repository/revisions/2" class="changeset" title="This commit fixes #1, #2 and references #1 & #3">r2</a>') |
|
64 | # link to a changeset | |
|
65 | assert_select "a[href=?][title=?]", "http://mydomain.foo/rdm/projects/ecookbook/repository/revisions/2", "This commit fixes #1, #2 and references #1 & #3", :text => "r2" | |||
|
66 | end | |||
62 | ensure |
|
67 | ensure | |
63 | # restore it |
|
68 | # restore it | |
64 | Redmine::Utils.relative_url_root = relative_url_root |
|
69 | Redmine::Utils.relative_url_root = relative_url_root | |
@@ -76,13 +81,15 class MailerTest < ActiveSupport::TestCase | |||||
76 |
|
81 | |||
77 | mail = ActionMailer::Base.deliveries.last |
|
82 | mail = ActionMailer::Base.deliveries.last | |
78 | assert_kind_of TMail::Mail, mail |
|
83 | assert_kind_of TMail::Mail, mail | |
79 | # link to the main ticket |
|
84 | ||
80 | assert mail.body.include?('<a href="http://mydomain.foo/rdm/issues/1">Bug #1: Can\'t print recipes</a>') |
|
85 | assert_select_email do | |
81 |
|
86 | # link to the main ticket | ||
82 | # link to a referenced ticket |
|
87 | assert_select "a[href=?]", "http://mydomain.foo/rdm/issues/1", :text => "Bug #1: Can't print recipes" | |
83 | assert mail.body.include?('<a href="http://mydomain.foo/rdm/issues/2" class="issue" title="Add ingredients categories (Assigned)">#2</a>') |
|
88 | # link to a referenced ticket | |
84 | # link to a changeset |
|
89 | assert_select "a[href=?][title=?]", "http://mydomain.foo/rdm/issues/2", "Add ingredients categories (Assigned)", :text => "#2" | |
85 | assert mail.body.include?('<a href="http://mydomain.foo/rdm/projects/ecookbook/repository/revisions/2" class="changeset" title="This commit fixes #1, #2 and references #1 & #3">r2</a>') |
|
90 | # link to a changeset | |
|
91 | assert_select "a[href=?][title=?]", "http://mydomain.foo/rdm/projects/ecookbook/repository/revisions/2", "This commit fixes #1, #2 and references #1 & #3", :text => "r2" | |||
|
92 | end | |||
86 | ensure |
|
93 | ensure | |
87 | # restore it |
|
94 | # restore it | |
88 | Redmine::Utils.relative_url_root = relative_url_root |
|
95 | Redmine::Utils.relative_url_root = relative_url_root |
General Comments 0
You need to be logged in to leave comments.
Login now