Mercurial > hg > soundsoftware-site
comparison .svn/pristine/f1/f12ea0342f077f022ecf07312830410824f9f131.svn-base @ 1296:038ba2d95de8 redmine-2.2
Fix redmine-2.2 branch update (add missing svn files)
author | Chris Cannam |
---|---|
date | Fri, 14 Jun 2013 09:05:06 +0100 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
1294:3e4c3460b6ca | 1296:038ba2d95de8 |
---|---|
1 require File.expand_path('../../test_helper', __FILE__) | |
2 | |
3 class ActivitiesControllerTest < ActionController::TestCase | |
4 fixtures :projects, :trackers, :issue_statuses, :issues, | |
5 :enumerations, :users, :issue_categories, | |
6 :projects_trackers, | |
7 :roles, | |
8 :member_roles, | |
9 :members, | |
10 :groups_users, | |
11 :enabled_modules, | |
12 :workflows, | |
13 :journals, :journal_details | |
14 | |
15 | |
16 def test_project_index | |
17 get :index, :id => 1, :with_subprojects => 0 | |
18 assert_response :success | |
19 assert_template 'index' | |
20 assert_not_nil assigns(:events_by_day) | |
21 | |
22 assert_tag :tag => "h3", | |
23 :content => /#{2.days.ago.to_date.day}/, | |
24 :sibling => { :tag => "dl", | |
25 :child => { :tag => "dt", | |
26 :attributes => { :class => /issue-edit/ }, | |
27 :child => { :tag => "a", | |
28 :content => /(#{IssueStatus.find(2).name})/, | |
29 } | |
30 } | |
31 } | |
32 end | |
33 | |
34 def test_project_index_with_invalid_project_id_should_respond_404 | |
35 get :index, :id => 299 | |
36 assert_response 404 | |
37 end | |
38 | |
39 def test_previous_project_index | |
40 get :index, :id => 1, :from => 3.days.ago.to_date | |
41 assert_response :success | |
42 assert_template 'index' | |
43 assert_not_nil assigns(:events_by_day) | |
44 | |
45 assert_tag :tag => "h3", | |
46 :content => /#{3.day.ago.to_date.day}/, | |
47 :sibling => { :tag => "dl", | |
48 :child => { :tag => "dt", | |
49 :attributes => { :class => /issue/ }, | |
50 :child => { :tag => "a", | |
51 :content => /Can't print recipes/, | |
52 } | |
53 } | |
54 } | |
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 assert_tag :tag => "h3", | |
67 :content => /#{d5.day}/, | |
68 :sibling => { :tag => "dl", | |
69 :child => { :tag => "dt", | |
70 :attributes => { :class => /issue/ }, | |
71 :child => { :tag => "a", | |
72 :content => /Subproject issue/, | |
73 } | |
74 } | |
75 } | |
76 end | |
77 | |
78 def test_user_index | |
79 @request.session[:user_id] = 1 | |
80 get :index, :user_id => 2 | |
81 assert_response :success | |
82 assert_template 'index' | |
83 assert_not_nil assigns(:events_by_day) | |
84 | |
85 assert_select 'h2 a[href=/users/2]', :text => 'John Smith' | |
86 | |
87 i1 = Issue.find(1) | |
88 d1 = User.find(1).time_to_date(i1.created_on) | |
89 | |
90 assert_tag :tag => "h3", | |
91 :content => /#{d1.day}/, | |
92 :sibling => { :tag => "dl", | |
93 :child => { :tag => "dt", | |
94 :attributes => { :class => /issue/ }, | |
95 :child => { :tag => "a", | |
96 :content => /Can't print recipes/, | |
97 } | |
98 } | |
99 } | |
100 end | |
101 | |
102 def test_user_index_with_invalid_user_id_should_respond_404 | |
103 get :index, :user_id => 299 | |
104 assert_response 404 | |
105 end | |
106 | |
107 def test_index_atom_feed | |
108 get :index, :format => 'atom', :with_subprojects => 0 | |
109 assert_response :success | |
110 assert_template 'common/feed' | |
111 | |
112 assert_tag :tag => 'link', :parent => {:tag => 'feed', :parent => nil }, | |
113 :attributes => {:rel => 'self', :href => 'http://test.host/activity.atom?with_subprojects=0'} | |
114 assert_tag :tag => 'link', :parent => {:tag => 'feed', :parent => nil }, | |
115 :attributes => {:rel => 'alternate', :href => 'http://test.host/activity?with_subprojects=0'} | |
116 | |
117 assert_tag :tag => 'entry', :child => { | |
118 :tag => 'link', | |
119 :attributes => {:href => 'http://test.host/issues/11'}} | |
120 end | |
121 | |
122 def test_index_atom_feed_with_explicit_selection | |
123 get :index, :format => 'atom', :with_subprojects => 0, | |
124 :show_changesets => 1, | |
125 :show_documents => 1, | |
126 :show_files => 1, | |
127 :show_issues => 1, | |
128 :show_messages => 1, | |
129 :show_news => 1, | |
130 :show_time_entries => 1, | |
131 :show_wiki_edits => 1 | |
132 | |
133 assert_response :success | |
134 assert_template 'common/feed' | |
135 | |
136 assert_tag :tag => 'link', :parent => {:tag => 'feed', :parent => nil }, | |
137 :attributes => {: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'} | |
138 assert_tag :tag => 'link', :parent => {:tag => 'feed', :parent => nil }, | |
139 :attributes => {: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'} | |
140 | |
141 assert_tag :tag => 'entry', :child => { | |
142 :tag => 'link', | |
143 :attributes => {:href => 'http://test.host/issues/11'}} | |
144 end | |
145 | |
146 def test_index_atom_feed_with_one_item_type | |
147 get :index, :format => 'atom', :show_issues => '1' | |
148 assert_response :success | |
149 assert_template 'common/feed' | |
150 assert_tag :tag => 'title', :content => /Issues/ | |
151 end | |
152 | |
153 def test_index_should_show_private_notes_with_permission_only | |
154 journal = Journal.create!(:journalized => Issue.find(2), :notes => 'Private notes with searchkeyword', :private_notes => true) | |
155 @request.session[:user_id] = 2 | |
156 | |
157 get :index | |
158 assert_response :success | |
159 assert_include journal, assigns(:events_by_day).values.flatten | |
160 | |
161 Role.find(1).remove_permission! :view_private_notes | |
162 get :index | |
163 assert_response :success | |
164 assert_not_include journal, assigns(:events_by_day).values.flatten | |
165 end | |
166 end |