##// END OF EJS Templates
Fixed: atom links on wiki index broken by r4266....
Jean-Philippe Lang -
r5066:53ad42e1d841
parent child
Show More
@@ -1,33 +1,33
1 1 <div class="contextual">
2 2 <%= watcher_tag(@wiki, User.current) %>
3 3 </div>
4 4
5 5 <h2><%= l(:label_index_by_date) %></h2>
6 6
7 7 <% if @pages.empty? %>
8 8 <p class="nodata"><%= l(:label_no_data) %></p>
9 9 <% end %>
10 10
11 11 <% @pages_by_date.keys.sort.reverse.each do |date| %>
12 12 <h3><%= format_date(date) %></h3>
13 13 <ul>
14 14 <% @pages_by_date[date].each do |page| %>
15 15 <li><%= link_to page.pretty_title, :action => 'show', :id => page.title, :project_id => page.project %></li>
16 16 <% end %>
17 17 </ul>
18 18 <% end %>
19 19
20 20 <% content_for :sidebar do %>
21 21 <%= render :partial => 'sidebar' %>
22 22 <% end %>
23 23
24 24 <% unless @pages.empty? %>
25 25 <% other_formats_links do |f| %>
26 <%= f.link_to 'Atom', :url => {:controller => 'activities', :action => 'show', :id => @project, :show_wiki_edits => 1, :key => User.current.rss_key} %>
26 <%= f.link_to 'Atom', :url => {:controller => 'activities', :action => 'index', :id => @project, :show_wiki_edits => 1, :key => User.current.rss_key} %>
27 27 <%= f.link_to('HTML', :url => {:action => 'export'}) if User.current.allowed_to?(:export_wiki_pages, @project) %>
28 28 <% end %>
29 29 <% end %>
30 30
31 31 <% content_for :header_tags do %>
32 <%= auto_discovery_link_tag(:atom, :controller => 'activities', :action => 'show', :id => @project, :show_wiki_edits => 1, :format => 'atom', :key => User.current.rss_key) %>
32 <%= auto_discovery_link_tag(:atom, :controller => 'activities', :action => 'index', :id => @project, :show_wiki_edits => 1, :format => 'atom', :key => User.current.rss_key) %>
33 33 <% end %>
@@ -1,26 +1,26
1 1 <div class="contextual">
2 2 <%= watcher_tag(@wiki, User.current) %>
3 3 </div>
4 4
5 5 <h2><%= l(:label_index_by_title) %></h2>
6 6
7 7 <% if @pages.empty? %>
8 8 <p class="nodata"><%= l(:label_no_data) %></p>
9 9 <% end %>
10 10
11 11 <%= render_page_hierarchy(@pages_by_parent_id, nil, :timestamp => true) %>
12 12
13 13 <% content_for :sidebar do %>
14 14 <%= render :partial => 'sidebar' %>
15 15 <% end %>
16 16
17 17 <% unless @pages.empty? %>
18 18 <% other_formats_links do |f| %>
19 <%= f.link_to 'Atom', :url => {:controller => 'activities', :action => 'show', :id => @project, :show_wiki_edits => 1, :key => User.current.rss_key} %>
19 <%= f.link_to 'Atom', :url => {:controller => 'activities', :action => 'index', :id => @project, :show_wiki_edits => 1, :key => User.current.rss_key} %>
20 20 <%= f.link_to('HTML', :url => {:action => 'export'}) if User.current.allowed_to?(:export_wiki_pages, @project) %>
21 21 <% end %>
22 22 <% end %>
23 23
24 24 <% content_for :header_tags do %>
25 <%= auto_discovery_link_tag(:atom, :controller => 'activities', :action => 'show', :id => @project, :show_wiki_edits => 1, :format => 'atom', :key => User.current.rss_key) %>
25 <%= auto_discovery_link_tag(:atom, :controller => 'activities', :action => 'index', :id => @project, :show_wiki_edits => 1, :format => 'atom', :key => User.current.rss_key) %>
26 26 <% end %>
@@ -1,496 +1,504
1 1 # Redmine - project management software
2 2 # Copyright (C) 2006-2011 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 require 'wiki_controller'
20 20
21 21 # Re-raise errors caught by the controller.
22 22 class WikiController; def rescue_action(e) raise e end; end
23 23
24 24 class WikiControllerTest < ActionController::TestCase
25 25 fixtures :projects, :users, :roles, :members, :member_roles, :enabled_modules, :wikis, :wiki_pages, :wiki_contents, :wiki_content_versions, :attachments
26 26
27 27 def setup
28 28 @controller = WikiController.new
29 29 @request = ActionController::TestRequest.new
30 30 @response = ActionController::TestResponse.new
31 31 User.current = nil
32 32 end
33 33
34 34 def test_show_start_page
35 35 get :show, :project_id => 'ecookbook'
36 36 assert_response :success
37 37 assert_template 'show'
38 38 assert_tag :tag => 'h1', :content => /CookBook documentation/
39 39
40 40 # child_pages macro
41 41 assert_tag :ul, :attributes => { :class => 'pages-hierarchy' },
42 42 :child => { :tag => 'li',
43 43 :child => { :tag => 'a', :attributes => { :href => '/projects/ecookbook/wiki/Page_with_an_inline_image' },
44 44 :content => 'Page with an inline image' } }
45 45 end
46 46
47 47 def test_show_page_with_name
48 48 get :show, :project_id => 1, :id => 'Another_page'
49 49 assert_response :success
50 50 assert_template 'show'
51 51 assert_tag :tag => 'h1', :content => /Another page/
52 52 # Included page with an inline image
53 53 assert_tag :tag => 'p', :content => /This is an inline image/
54 54 assert_tag :tag => 'img', :attributes => { :src => '/attachments/download/3',
55 55 :alt => 'This is a logo' }
56 56 end
57 57
58 58 def test_show_with_sidebar
59 59 page = Project.find(1).wiki.pages.new(:title => 'Sidebar')
60 60 page.content = WikiContent.new(:text => 'Side bar content for test_show_with_sidebar')
61 61 page.save!
62 62
63 63 get :show, :project_id => 1, :id => 'Another_page'
64 64 assert_response :success
65 65 assert_tag :tag => 'div', :attributes => {:id => 'sidebar'},
66 66 :content => /Side bar content for test_show_with_sidebar/
67 67 end
68 68
69 69 def test_show_unexistent_page_without_edit_right
70 70 get :show, :project_id => 1, :id => 'Unexistent page'
71 71 assert_response 404
72 72 end
73 73
74 74 def test_show_unexistent_page_with_edit_right
75 75 @request.session[:user_id] = 2
76 76 get :show, :project_id => 1, :id => 'Unexistent page'
77 77 assert_response :success
78 78 assert_template 'edit'
79 79 end
80 80
81 81 def test_create_page
82 82 @request.session[:user_id] = 2
83 83 put :update, :project_id => 1,
84 84 :id => 'New page',
85 85 :content => {:comments => 'Created the page',
86 86 :text => "h1. New page\n\nThis is a new page",
87 87 :version => 0}
88 88 assert_redirected_to :action => 'show', :project_id => 'ecookbook', :id => 'New_page'
89 89 page = Project.find(1).wiki.find_page('New page')
90 90 assert !page.new_record?
91 91 assert_not_nil page.content
92 92 assert_equal 'Created the page', page.content.comments
93 93 end
94 94
95 95 def test_create_page_with_attachments
96 96 @request.session[:user_id] = 2
97 97 assert_difference 'WikiPage.count' do
98 98 assert_difference 'Attachment.count' do
99 99 put :update, :project_id => 1,
100 100 :id => 'New page',
101 101 :content => {:comments => 'Created the page',
102 102 :text => "h1. New page\n\nThis is a new page",
103 103 :version => 0},
104 104 :attachments => {'1' => {'file' => uploaded_test_file('testfile.txt', 'text/plain')}}
105 105 end
106 106 end
107 107 page = Project.find(1).wiki.find_page('New page')
108 108 assert_equal 1, page.attachments.count
109 109 assert_equal 'testfile.txt', page.attachments.first.filename
110 110 end
111 111
112 112 def test_update_page
113 113 @request.session[:user_id] = 2
114 114 assert_no_difference 'WikiPage.count' do
115 115 assert_no_difference 'WikiContent.count' do
116 116 assert_difference 'WikiContent::Version.count' do
117 117 put :update, :project_id => 1,
118 118 :id => 'Another_page',
119 119 :content => {
120 120 :comments => "my comments",
121 121 :text => "edited",
122 122 :version => 1
123 123 }
124 124 end
125 125 end
126 126 end
127 127 assert_redirected_to '/projects/ecookbook/wiki/Another_page'
128 128
129 129 page = Wiki.find(1).pages.find_by_title('Another_page')
130 130 assert_equal "edited", page.content.text
131 131 assert_equal 2, page.content.version
132 132 assert_equal "my comments", page.content.comments
133 133 end
134 134
135 135 def test_update_page_with_failure
136 136 @request.session[:user_id] = 2
137 137 assert_no_difference 'WikiPage.count' do
138 138 assert_no_difference 'WikiContent.count' do
139 139 assert_no_difference 'WikiContent::Version.count' do
140 140 put :update, :project_id => 1,
141 141 :id => 'Another_page',
142 142 :content => {
143 143 :comments => 'a' * 300, # failure here, comment is too long
144 144 :text => 'edited',
145 145 :version => 1
146 146 }
147 147 end
148 148 end
149 149 end
150 150 assert_response :success
151 151 assert_template 'edit'
152 152
153 153 assert_error_tag :descendant => {:content => /Comment is too long/}
154 154 assert_tag :tag => 'textarea', :attributes => {:id => 'content_text'}, :content => 'edited'
155 155 assert_tag :tag => 'input', :attributes => {:id => 'content_version', :value => '1'}
156 156 end
157 157
158 158 def test_update_stale_page_should_not_raise_an_error
159 159 @request.session[:user_id] = 2
160 160 c = Wiki.find(1).find_page('Another_page').content
161 161 c.text = 'Previous text'
162 162 c.save!
163 163 assert_equal 2, c.version
164 164
165 165 assert_no_difference 'WikiPage.count' do
166 166 assert_no_difference 'WikiContent.count' do
167 167 assert_no_difference 'WikiContent::Version.count' do
168 168 put :update, :project_id => 1,
169 169 :id => 'Another_page',
170 170 :content => {
171 171 :comments => 'My comments',
172 172 :text => 'Text should not be lost',
173 173 :version => 1
174 174 }
175 175 end
176 176 end
177 177 end
178 178 assert_response :success
179 179 assert_template 'edit'
180 180 assert_tag :div,
181 181 :attributes => { :class => /error/ },
182 182 :content => /Data has been updated by another user/
183 183 assert_tag 'textarea',
184 184 :attributes => { :name => 'content[text]' },
185 185 :content => /Text should not be lost/
186 186 assert_tag 'input',
187 187 :attributes => { :name => 'content[comments]', :value => 'My comments' }
188 188
189 189 c.reload
190 190 assert_equal 'Previous text', c.text
191 191 assert_equal 2, c.version
192 192 end
193 193
194 194 def test_preview
195 195 @request.session[:user_id] = 2
196 196 xhr :post, :preview, :project_id => 1, :id => 'CookBook_documentation',
197 197 :content => { :comments => '',
198 198 :text => 'this is a *previewed text*',
199 199 :version => 3 }
200 200 assert_response :success
201 201 assert_template 'common/_preview'
202 202 assert_tag :tag => 'strong', :content => /previewed text/
203 203 end
204 204
205 205 def test_preview_new_page
206 206 @request.session[:user_id] = 2
207 207 xhr :post, :preview, :project_id => 1, :id => 'New page',
208 208 :content => { :text => 'h1. New page',
209 209 :comments => '',
210 210 :version => 0 }
211 211 assert_response :success
212 212 assert_template 'common/_preview'
213 213 assert_tag :tag => 'h1', :content => /New page/
214 214 end
215 215
216 216 def test_history
217 217 get :history, :project_id => 1, :id => 'CookBook_documentation'
218 218 assert_response :success
219 219 assert_template 'history'
220 220 assert_not_nil assigns(:versions)
221 221 assert_equal 3, assigns(:versions).size
222 222 assert_select "input[type=submit][name=commit]"
223 223 end
224 224
225 225 def test_history_with_one_version
226 226 get :history, :project_id => 1, :id => 'Another_page'
227 227 assert_response :success
228 228 assert_template 'history'
229 229 assert_not_nil assigns(:versions)
230 230 assert_equal 1, assigns(:versions).size
231 231 assert_select "input[type=submit][name=commit]", false
232 232 end
233 233
234 234 def test_diff
235 235 get :diff, :project_id => 1, :id => 'CookBook_documentation', :version => 2, :version_from => 1
236 236 assert_response :success
237 237 assert_template 'diff'
238 238 assert_tag :tag => 'span', :attributes => { :class => 'diff_in'},
239 239 :content => /updated/
240 240 end
241 241
242 242 def test_annotate
243 243 get :annotate, :project_id => 1, :id => 'CookBook_documentation', :version => 2
244 244 assert_response :success
245 245 assert_template 'annotate'
246 246 # Line 1
247 247 assert_tag :tag => 'tr', :child => { :tag => 'th', :attributes => {:class => 'line-num'}, :content => '1' },
248 248 :child => { :tag => 'td', :attributes => {:class => 'author'}, :content => /John Smith/ },
249 249 :child => { :tag => 'td', :content => /h1\. CookBook documentation/ }
250 250 # Line 2
251 251 assert_tag :tag => 'tr', :child => { :tag => 'th', :attributes => {:class => 'line-num'}, :content => '2' },
252 252 :child => { :tag => 'td', :attributes => {:class => 'author'}, :content => /redMine Admin/ },
253 253 :child => { :tag => 'td', :content => /Some updated \[\[documentation\]\] here/ }
254 254 end
255 255
256 256 def test_get_rename
257 257 @request.session[:user_id] = 2
258 258 get :rename, :project_id => 1, :id => 'Another_page'
259 259 assert_response :success
260 260 assert_template 'rename'
261 261 assert_tag 'option',
262 262 :attributes => {:value => ''},
263 263 :content => '',
264 264 :parent => {:tag => 'select', :attributes => {:name => 'wiki_page[parent_id]'}}
265 265 assert_no_tag 'option',
266 266 :attributes => {:selected => 'selected'},
267 267 :parent => {:tag => 'select', :attributes => {:name => 'wiki_page[parent_id]'}}
268 268 end
269 269
270 270 def test_get_rename_child_page
271 271 @request.session[:user_id] = 2
272 272 get :rename, :project_id => 1, :id => 'Child_1'
273 273 assert_response :success
274 274 assert_template 'rename'
275 275 assert_tag 'option',
276 276 :attributes => {:value => ''},
277 277 :content => '',
278 278 :parent => {:tag => 'select', :attributes => {:name => 'wiki_page[parent_id]'}}
279 279 assert_tag 'option',
280 280 :attributes => {:value => '2', :selected => 'selected'},
281 281 :content => /Another page/,
282 282 :parent => {
283 283 :tag => 'select',
284 284 :attributes => {:name => 'wiki_page[parent_id]'}
285 285 }
286 286 end
287 287
288 288 def test_rename_with_redirect
289 289 @request.session[:user_id] = 2
290 290 post :rename, :project_id => 1, :id => 'Another_page',
291 291 :wiki_page => { :title => 'Another renamed page',
292 292 :redirect_existing_links => 1 }
293 293 assert_redirected_to :action => 'show', :project_id => 'ecookbook', :id => 'Another_renamed_page'
294 294 wiki = Project.find(1).wiki
295 295 # Check redirects
296 296 assert_not_nil wiki.find_page('Another page')
297 297 assert_nil wiki.find_page('Another page', :with_redirect => false)
298 298 end
299 299
300 300 def test_rename_without_redirect
301 301 @request.session[:user_id] = 2
302 302 post :rename, :project_id => 1, :id => 'Another_page',
303 303 :wiki_page => { :title => 'Another renamed page',
304 304 :redirect_existing_links => "0" }
305 305 assert_redirected_to :action => 'show', :project_id => 'ecookbook', :id => 'Another_renamed_page'
306 306 wiki = Project.find(1).wiki
307 307 # Check that there's no redirects
308 308 assert_nil wiki.find_page('Another page')
309 309 end
310 310
311 311 def test_rename_with_parent_assignment
312 312 @request.session[:user_id] = 2
313 313 post :rename, :project_id => 1, :id => 'Another_page',
314 314 :wiki_page => { :title => 'Another page', :redirect_existing_links => "0", :parent_id => '4' }
315 315 assert_redirected_to :action => 'show', :project_id => 'ecookbook', :id => 'Another_page'
316 316 assert_equal WikiPage.find(4), WikiPage.find_by_title('Another_page').parent
317 317 end
318 318
319 319 def test_rename_with_parent_unassignment
320 320 @request.session[:user_id] = 2
321 321 post :rename, :project_id => 1, :id => 'Child_1',
322 322 :wiki_page => { :title => 'Child 1', :redirect_existing_links => "0", :parent_id => '' }
323 323 assert_redirected_to :action => 'show', :project_id => 'ecookbook', :id => 'Child_1'
324 324 assert_nil WikiPage.find_by_title('Child_1').parent
325 325 end
326 326
327 327 def test_destroy_child
328 328 @request.session[:user_id] = 2
329 329 delete :destroy, :project_id => 1, :id => 'Child_1'
330 330 assert_redirected_to :action => 'index', :project_id => 'ecookbook'
331 331 end
332 332
333 333 def test_destroy_parent
334 334 @request.session[:user_id] = 2
335 335 assert_no_difference('WikiPage.count') do
336 336 delete :destroy, :project_id => 1, :id => 'Another_page'
337 337 end
338 338 assert_response :success
339 339 assert_template 'destroy'
340 340 end
341 341
342 342 def test_destroy_parent_with_nullify
343 343 @request.session[:user_id] = 2
344 344 assert_difference('WikiPage.count', -1) do
345 345 delete :destroy, :project_id => 1, :id => 'Another_page', :todo => 'nullify'
346 346 end
347 347 assert_redirected_to :action => 'index', :project_id => 'ecookbook'
348 348 assert_nil WikiPage.find_by_id(2)
349 349 end
350 350
351 351 def test_destroy_parent_with_cascade
352 352 @request.session[:user_id] = 2
353 353 assert_difference('WikiPage.count', -3) do
354 354 delete :destroy, :project_id => 1, :id => 'Another_page', :todo => 'destroy'
355 355 end
356 356 assert_redirected_to :action => 'index', :project_id => 'ecookbook'
357 357 assert_nil WikiPage.find_by_id(2)
358 358 assert_nil WikiPage.find_by_id(5)
359 359 end
360 360
361 361 def test_destroy_parent_with_reassign
362 362 @request.session[:user_id] = 2
363 363 assert_difference('WikiPage.count', -1) do
364 364 delete :destroy, :project_id => 1, :id => 'Another_page', :todo => 'reassign', :reassign_to_id => 1
365 365 end
366 366 assert_redirected_to :action => 'index', :project_id => 'ecookbook'
367 367 assert_nil WikiPage.find_by_id(2)
368 368 assert_equal WikiPage.find(1), WikiPage.find_by_id(5).parent
369 369 end
370 370
371 371 def test_index
372 372 get :index, :project_id => 'ecookbook'
373 373 assert_response :success
374 374 assert_template 'index'
375 375 pages = assigns(:pages)
376 376 assert_not_nil pages
377 377 assert_equal Project.find(1).wiki.pages.size, pages.size
378 378 assert_equal pages.first.content.updated_on, pages.first.updated_on
379 379
380 380 assert_tag :ul, :attributes => { :class => 'pages-hierarchy' },
381 381 :child => { :tag => 'li', :child => { :tag => 'a', :attributes => { :href => '/projects/ecookbook/wiki/CookBook_documentation' },
382 382 :content => 'CookBook documentation' },
383 383 :child => { :tag => 'ul',
384 384 :child => { :tag => 'li',
385 385 :child => { :tag => 'a', :attributes => { :href => '/projects/ecookbook/wiki/Page_with_an_inline_image' },
386 386 :content => 'Page with an inline image' } } } },
387 387 :child => { :tag => 'li', :child => { :tag => 'a', :attributes => { :href => '/projects/ecookbook/wiki/Another_page' },
388 388 :content => 'Another page' } }
389 389 end
390 390
391 def test_index_should_include_atom_link
392 get :index, :project_id => 'ecookbook'
393 assert_tag 'a', :attributes => { :href => '/projects/ecookbook/activity.atom?show_wiki_edits=1'}
394 end
395
391 396 context "GET :export" do
392 397 context "with an authorized user to export the wiki" do
393 398 setup do
394 399 @request.session[:user_id] = 2
395 400 get :export, :project_id => 'ecookbook'
396 401 end
397 402
398 403 should_respond_with :success
399 404 should_assign_to :pages
400 405 should_respond_with_content_type "text/html"
401 406 should "export all of the wiki pages to a single html file" do
402 407 assert_select "a[name=?]", "CookBook_documentation"
403 408 assert_select "a[name=?]", "Another_page"
404 409 assert_select "a[name=?]", "Page_with_an_inline_image"
405 410 end
406 411
407 412 end
408 413
409 414 context "with an unauthorized user" do
410 415 setup do
411 416 get :export, :project_id => 'ecookbook'
412 417
413 418 should_respond_with :redirect
414 419 should_redirect_to('wiki index') { {:action => 'show', :project_id => @project, :id => nil} }
415 420 end
416 421 end
417 422 end
418 423
419 424 context "GET :date_index" do
420 425 setup do
421 426 get :date_index, :project_id => 'ecookbook'
422 427 end
423 428
424 429 should_respond_with :success
425 430 should_assign_to :pages
426 431 should_assign_to :pages_by_date
427 432 should_render_template 'wiki/date_index'
428 433
434 should "include atom link" do
435 assert_tag 'a', :attributes => { :href => '/projects/ecookbook/activity.atom?show_wiki_edits=1'}
436 end
429 437 end
430 438
431 439 def test_not_found
432 440 get :show, :project_id => 999
433 441 assert_response 404
434 442 end
435 443
436 444 def test_protect_page
437 445 page = WikiPage.find_by_wiki_id_and_title(1, 'Another_page')
438 446 assert !page.protected?
439 447 @request.session[:user_id] = 2
440 448 post :protect, :project_id => 1, :id => page.title, :protected => '1'
441 449 assert_redirected_to :action => 'show', :project_id => 'ecookbook', :id => 'Another_page'
442 450 assert page.reload.protected?
443 451 end
444 452
445 453 def test_unprotect_page
446 454 page = WikiPage.find_by_wiki_id_and_title(1, 'CookBook_documentation')
447 455 assert page.protected?
448 456 @request.session[:user_id] = 2
449 457 post :protect, :project_id => 1, :id => page.title, :protected => '0'
450 458 assert_redirected_to :action => 'show', :project_id => 'ecookbook', :id => 'CookBook_documentation'
451 459 assert !page.reload.protected?
452 460 end
453 461
454 462 def test_show_page_with_edit_link
455 463 @request.session[:user_id] = 2
456 464 get :show, :project_id => 1
457 465 assert_response :success
458 466 assert_template 'show'
459 467 assert_tag :tag => 'a', :attributes => { :href => '/projects/1/wiki/CookBook_documentation/edit' }
460 468 end
461 469
462 470 def test_show_page_without_edit_link
463 471 @request.session[:user_id] = 4
464 472 get :show, :project_id => 1
465 473 assert_response :success
466 474 assert_template 'show'
467 475 assert_no_tag :tag => 'a', :attributes => { :href => '/projects/1/wiki/CookBook_documentation/edit' }
468 476 end
469 477
470 478 def test_edit_unprotected_page
471 479 # Non members can edit unprotected wiki pages
472 480 @request.session[:user_id] = 4
473 481 get :edit, :project_id => 1, :id => 'Another_page'
474 482 assert_response :success
475 483 assert_template 'edit'
476 484 end
477 485
478 486 def test_edit_protected_page_by_nonmember
479 487 # Non members can't edit protected wiki pages
480 488 @request.session[:user_id] = 4
481 489 get :edit, :project_id => 1, :id => 'CookBook_documentation'
482 490 assert_response 403
483 491 end
484 492
485 493 def test_edit_protected_page_by_member
486 494 @request.session[:user_id] = 2
487 495 get :edit, :project_id => 1, :id => 'CookBook_documentation'
488 496 assert_response :success
489 497 assert_template 'edit'
490 498 end
491 499
492 500 def test_history_of_non_existing_page_should_return_404
493 501 get :history, :project_id => 1, :id => 'Unknown_page'
494 502 assert_response 404
495 503 end
496 504 end
General Comments 0
You need to be logged in to leave comments. Login now