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