##// END OF EJS Templates
use escaped "Can't" constant at IssueStatusesControllerTest...
Toshi MARUYAMA -
r12530:760f88bd58ca
parent child
Show More
@@ -1,150 +1,150
1 1 # Redmine - project management software
2 2 # Copyright (C) 2006-2014 Jean-Philippe Lang
3 3 #
4 4 # This program is free software; you can redistribute it and/or
5 5 # modify it under the terms of the GNU General Public License
6 6 # as published by the Free Software Foundation; either version 2
7 7 # of the License, or (at your option) any later version.
8 8 #
9 9 # This program is distributed in the hope that it will be useful,
10 10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 12 # GNU General Public License for more details.
13 13 #
14 14 # You should have received a copy of the GNU General Public License
15 15 # along with this program; if not, write to the Free Software
16 16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 17
18 18 require File.expand_path('../../test_helper', __FILE__)
19 19
20 20 class ActivitiesControllerTest < ActionController::TestCase
21 21 fixtures :projects, :trackers, :issue_statuses, :issues,
22 22 :enumerations, :users, :issue_categories,
23 23 :projects_trackers,
24 24 :roles,
25 25 :member_roles,
26 26 :members,
27 27 :groups_users,
28 28 :enabled_modules,
29 29 :journals, :journal_details
30 30
31 31
32 32 def test_project_index
33 33 get :index, :id => 1, :with_subprojects => 0
34 34 assert_response :success
35 35 assert_template 'index'
36 36 assert_not_nil assigns(:events_by_day)
37 37
38 38 assert_select 'h3', :text => /#{2.days.ago.to_date.day}/
39 39 assert_select 'dl dt.issue-edit a', :text => /(#{IssueStatus.find(2).name})/
40 40 end
41 41
42 42 def test_project_index_with_invalid_project_id_should_respond_404
43 43 get :index, :id => 299
44 44 assert_response 404
45 45 end
46 46
47 47 def test_previous_project_index
48 48 get :index, :id => 1, :from => 2.days.ago.to_date
49 49 assert_response :success
50 50 assert_template 'index'
51 51 assert_not_nil assigns(:events_by_day)
52 52
53 53 assert_select 'h3', :text => /#{3.days.ago.to_date.day}/
54 assert_select 'dl dt.issue a', :text => /Can&#x27;t print recipes/
54 assert_select 'dl dt.issue a', :text => /#{ESCAPED_UCANT} print recipes/
55 55 end
56 56
57 57 def test_global_index
58 58 @request.session[:user_id] = 1
59 59 get :index
60 60 assert_response :success
61 61 assert_template 'index'
62 62 assert_not_nil assigns(:events_by_day)
63 63
64 64 i5 = Issue.find(5)
65 65 d5 = User.find(1).time_to_date(i5.created_on)
66 66
67 67 assert_select 'h3', :text => /#{d5.day}/
68 68 assert_select 'dl dt.issue a', :text => /Subproject issue/
69 69 end
70 70
71 71 def test_user_index
72 72 @request.session[:user_id] = 1
73 73 get :index, :user_id => 2
74 74 assert_response :success
75 75 assert_template 'index'
76 76 assert_not_nil assigns(:events_by_day)
77 77
78 78 assert_select 'h2 a[href=/users/2]', :text => 'John Smith'
79 79
80 80 i1 = Issue.find(1)
81 81 d1 = User.find(1).time_to_date(i1.created_on)
82 82
83 83 assert_select 'h3', :text => /#{d1.day}/
84 assert_select 'dl dt.issue a', :text => /Can&#x27;t print recipes/
84 assert_select 'dl dt.issue a', :text => /#{ESCAPED_UCANT} print recipes/
85 85 end
86 86
87 87 def test_user_index_with_invalid_user_id_should_respond_404
88 88 get :index, :user_id => 299
89 89 assert_response 404
90 90 end
91 91
92 92 def test_index_atom_feed
93 93 get :index, :format => 'atom', :with_subprojects => 0
94 94 assert_response :success
95 95 assert_template 'common/feed'
96 96
97 97 assert_select 'feed' do
98 98 assert_select 'link[rel=self][href=?]', 'http://test.host/activity.atom?with_subprojects=0'
99 99 assert_select 'link[rel=alternate][href=?]', 'http://test.host/activity?with_subprojects=0'
100 100 assert_select 'entry' do
101 101 assert_select 'link[href=?]', 'http://test.host/issues/11'
102 102 end
103 103 end
104 104 end
105 105
106 106 def test_index_atom_feed_with_explicit_selection
107 107 get :index, :format => 'atom', :with_subprojects => 0,
108 108 :show_changesets => 1,
109 109 :show_documents => 1,
110 110 :show_files => 1,
111 111 :show_issues => 1,
112 112 :show_messages => 1,
113 113 :show_news => 1,
114 114 :show_time_entries => 1,
115 115 :show_wiki_edits => 1
116 116
117 117 assert_response :success
118 118 assert_template 'common/feed'
119 119
120 120 assert_select 'feed' do
121 121 assert_select 'link[rel=self][href=?]', 'http://test.host/activity.atom?show_changesets=1&amp;show_documents=1&amp;show_files=1&amp;show_issues=1&amp;show_messages=1&amp;show_news=1&amp;show_time_entries=1&amp;show_wiki_edits=1&amp;with_subprojects=0'
122 122 assert_select 'link[rel=alternate][href=?]', 'http://test.host/activity?show_changesets=1&amp;show_documents=1&amp;show_files=1&amp;show_issues=1&amp;show_messages=1&amp;show_news=1&amp;show_time_entries=1&amp;show_wiki_edits=1&amp;with_subprojects=0'
123 123 assert_select 'entry' do
124 124 assert_select 'link[href=?]', 'http://test.host/issues/11'
125 125 end
126 126 end
127 127 end
128 128
129 129 def test_index_atom_feed_with_one_item_type
130 130 get :index, :format => 'atom', :show_issues => '1'
131 131 assert_response :success
132 132 assert_template 'common/feed'
133 133
134 134 assert_select 'title', :text => /Issues/
135 135 end
136 136
137 137 def test_index_should_show_private_notes_with_permission_only
138 138 journal = Journal.create!(:journalized => Issue.find(2), :notes => 'Private notes with searchkeyword', :private_notes => true)
139 139 @request.session[:user_id] = 2
140 140
141 141 get :index
142 142 assert_response :success
143 143 assert_include journal, assigns(:events_by_day).values.flatten
144 144
145 145 Role.find(1).remove_permission! :view_private_notes
146 146 get :index
147 147 assert_response :success
148 148 assert_not_include journal, assigns(:events_by_day).values.flatten
149 149 end
150 150 end
General Comments 0
You need to be logged in to leave comments. Login now