comparison test/functional/.svn/text-base/wiki_controller_test.rb.svn-base @ 37:94944d00e43c

* Update to SVN trunk rev 4411
author Chris Cannam <chris.cannam@soundsoftware.ac.uk>
date Fri, 19 Nov 2010 13:24:41 +0000
parents 513646585e45
children af80e5618e9b
comparison
equal deleted inserted replaced
22:40f7cfd4df19 37:94944d00e43c
30 @response = ActionController::TestResponse.new 30 @response = ActionController::TestResponse.new
31 User.current = nil 31 User.current = nil
32 end 32 end
33 33
34 def test_show_start_page 34 def test_show_start_page
35 get :index, :id => 'ecookbook' 35 get :show, :project_id => 'ecookbook'
36 assert_response :success 36 assert_response :success
37 assert_template 'show' 37 assert_template 'show'
38 assert_tag :tag => 'h1', :content => /CookBook documentation/ 38 assert_tag :tag => 'h1', :content => /CookBook documentation/
39 39
40 # child_pages macro 40 # child_pages macro
43 :child => { :tag => 'a', :attributes => { :href => '/projects/ecookbook/wiki/Page_with_an_inline_image' }, 43 :child => { :tag => 'a', :attributes => { :href => '/projects/ecookbook/wiki/Page_with_an_inline_image' },
44 :content => 'Page with an inline image' } } 44 :content => 'Page with an inline image' } }
45 end 45 end
46 46
47 def test_show_page_with_name 47 def test_show_page_with_name
48 get :index, :id => 1, :page => 'Another_page' 48 get :show, :project_id => 1, :id => 'Another_page'
49 assert_response :success 49 assert_response :success
50 assert_template 'show' 50 assert_template 'show'
51 assert_tag :tag => 'h1', :content => /Another page/ 51 assert_tag :tag => 'h1', :content => /Another page/
52 # Included page with an inline image 52 # Included page with an inline image
53 assert_tag :tag => 'p', :content => /This is an inline image/ 53 assert_tag :tag => 'p', :content => /This is an inline image/
58 def test_show_with_sidebar 58 def test_show_with_sidebar
59 page = Project.find(1).wiki.pages.new(:title => 'Sidebar') 59 page = Project.find(1).wiki.pages.new(:title => 'Sidebar')
60 page.content = WikiContent.new(:text => 'Side bar content for test_show_with_sidebar') 60 page.content = WikiContent.new(:text => 'Side bar content for test_show_with_sidebar')
61 page.save! 61 page.save!
62 62
63 get :index, :id => 1, :page => 'Another_page' 63 get :show, :project_id => 1, :id => 'Another_page'
64 assert_response :success 64 assert_response :success
65 assert_tag :tag => 'div', :attributes => {:id => 'sidebar'}, 65 assert_tag :tag => 'div', :attributes => {:id => 'sidebar'},
66 :content => /Side bar content for test_show_with_sidebar/ 66 :content => /Side bar content for test_show_with_sidebar/
67 end 67 end
68 68
69 def test_show_unexistent_page_without_edit_right 69 def test_show_unexistent_page_without_edit_right
70 get :index, :id => 1, :page => 'Unexistent page' 70 get :show, :project_id => 1, :id => 'Unexistent page'
71 assert_response 404 71 assert_response 404
72 end 72 end
73 73
74 def test_show_unexistent_page_with_edit_right 74 def test_show_unexistent_page_with_edit_right
75 @request.session[:user_id] = 2 75 @request.session[:user_id] = 2
76 get :index, :id => 1, :page => 'Unexistent page' 76 get :show, :project_id => 1, :id => 'Unexistent page'
77 assert_response :success 77 assert_response :success
78 assert_template 'edit' 78 assert_template 'edit'
79 end 79 end
80 80
81 def test_create_page 81 def test_create_page
82 @request.session[:user_id] = 2 82 @request.session[:user_id] = 2
83 post :edit, :id => 1, 83 put :update, :project_id => 1,
84 :page => 'New page', 84 :id => 'New page',
85 :content => {:comments => 'Created the page', 85 :content => {:comments => 'Created the page',
86 :text => "h1. New page\n\nThis is a new page", 86 :text => "h1. New page\n\nThis is a new page",
87 :version => 0} 87 :version => 0}
88 assert_redirected_to :action => 'index', :id => 'ecookbook', :page => 'New_page' 88 assert_redirected_to :action => 'show', :project_id => 'ecookbook', :id => 'New_page'
89 page = Project.find(1).wiki.find_page('New page') 89 page = Project.find(1).wiki.find_page('New page')
90 assert !page.new_record? 90 assert !page.new_record?
91 assert_not_nil page.content 91 assert_not_nil page.content
92 assert_equal 'Created the page', page.content.comments 92 assert_equal 'Created the page', page.content.comments
93 end 93 end
94 94
95 def test_create_page_with_attachments 95 def test_create_page_with_attachments
96 @request.session[:user_id] = 2 96 @request.session[:user_id] = 2
97 assert_difference 'WikiPage.count' do 97 assert_difference 'WikiPage.count' do
98 assert_difference 'Attachment.count' do 98 assert_difference 'Attachment.count' do
99 post :edit, :id => 1, 99 put :update, :project_id => 1,
100 :page => 'New page', 100 :id => 'New page',
101 :content => {:comments => 'Created the page', 101 :content => {:comments => 'Created the page',
102 :text => "h1. New page\n\nThis is a new page", 102 :text => "h1. New page\n\nThis is a new page",
103 :version => 0}, 103 :version => 0},
104 :attachments => {'1' => {'file' => uploaded_test_file('testfile.txt', 'text/plain')}} 104 :attachments => {'1' => {'file' => uploaded_test_file('testfile.txt', 'text/plain')}}
105 end 105 end
109 assert_equal 'testfile.txt', page.attachments.first.filename 109 assert_equal 'testfile.txt', page.attachments.first.filename
110 end 110 end
111 111
112 def test_preview 112 def test_preview
113 @request.session[:user_id] = 2 113 @request.session[:user_id] = 2
114 xhr :post, :preview, :id => 1, :page => 'CookBook_documentation', 114 xhr :post, :preview, :project_id => 1, :id => 'CookBook_documentation',
115 :content => { :comments => '', 115 :content => { :comments => '',
116 :text => 'this is a *previewed text*', 116 :text => 'this is a *previewed text*',
117 :version => 3 } 117 :version => 3 }
118 assert_response :success 118 assert_response :success
119 assert_template 'common/_preview' 119 assert_template 'common/_preview'
120 assert_tag :tag => 'strong', :content => /previewed text/ 120 assert_tag :tag => 'strong', :content => /previewed text/
121 end 121 end
122 122
123 def test_preview_new_page 123 def test_preview_new_page
124 @request.session[:user_id] = 2 124 @request.session[:user_id] = 2
125 xhr :post, :preview, :id => 1, :page => 'New page', 125 xhr :post, :preview, :project_id => 1, :id => 'New page',
126 :content => { :text => 'h1. New page', 126 :content => { :text => 'h1. New page',
127 :comments => '', 127 :comments => '',
128 :version => 0 } 128 :version => 0 }
129 assert_response :success 129 assert_response :success
130 assert_template 'common/_preview' 130 assert_template 'common/_preview'
131 assert_tag :tag => 'h1', :content => /New page/ 131 assert_tag :tag => 'h1', :content => /New page/
132 end 132 end
133 133
134 def test_history 134 def test_history
135 get :history, :id => 1, :page => 'CookBook_documentation' 135 get :history, :project_id => 1, :id => 'CookBook_documentation'
136 assert_response :success 136 assert_response :success
137 assert_template 'history' 137 assert_template 'history'
138 assert_not_nil assigns(:versions) 138 assert_not_nil assigns(:versions)
139 assert_equal 3, assigns(:versions).size 139 assert_equal 3, assigns(:versions).size
140 assert_select "input[type=submit][name=commit]" 140 assert_select "input[type=submit][name=commit]"
141 end 141 end
142 142
143 def test_history_with_one_version 143 def test_history_with_one_version
144 get :history, :id => 1, :page => 'Another_page' 144 get :history, :project_id => 1, :id => 'Another_page'
145 assert_response :success 145 assert_response :success
146 assert_template 'history' 146 assert_template 'history'
147 assert_not_nil assigns(:versions) 147 assert_not_nil assigns(:versions)
148 assert_equal 1, assigns(:versions).size 148 assert_equal 1, assigns(:versions).size
149 assert_select "input[type=submit][name=commit]", false 149 assert_select "input[type=submit][name=commit]", false
150 end 150 end
151 151
152 def test_diff 152 def test_diff
153 get :diff, :id => 1, :page => 'CookBook_documentation', :version => 2, :version_from => 1 153 get :diff, :project_id => 1, :id => 'CookBook_documentation', :version => 2, :version_from => 1
154 assert_response :success 154 assert_response :success
155 assert_template 'diff' 155 assert_template 'diff'
156 assert_tag :tag => 'span', :attributes => { :class => 'diff_in'}, 156 assert_tag :tag => 'span', :attributes => { :class => 'diff_in'},
157 :content => /updated/ 157 :content => /updated/
158 end 158 end
159 159
160 def test_annotate 160 def test_annotate
161 get :annotate, :id => 1, :page => 'CookBook_documentation', :version => 2 161 get :annotate, :project_id => 1, :id => 'CookBook_documentation', :version => 2
162 assert_response :success 162 assert_response :success
163 assert_template 'annotate' 163 assert_template 'annotate'
164 # Line 1 164 # Line 1
165 assert_tag :tag => 'tr', :child => { :tag => 'th', :attributes => {:class => 'line-num'}, :content => '1' }, 165 assert_tag :tag => 'tr', :child => { :tag => 'th', :attributes => {:class => 'line-num'}, :content => '1' },
166 :child => { :tag => 'td', :attributes => {:class => 'author'}, :content => /John Smith/ }, 166 :child => { :tag => 'td', :attributes => {:class => 'author'}, :content => /John Smith/ },
168 # Line 2 168 # Line 2
169 assert_tag :tag => 'tr', :child => { :tag => 'th', :attributes => {:class => 'line-num'}, :content => '2' }, 169 assert_tag :tag => 'tr', :child => { :tag => 'th', :attributes => {:class => 'line-num'}, :content => '2' },
170 :child => { :tag => 'td', :attributes => {:class => 'author'}, :content => /redMine Admin/ }, 170 :child => { :tag => 'td', :attributes => {:class => 'author'}, :content => /redMine Admin/ },
171 :child => { :tag => 'td', :content => /Some updated \[\[documentation\]\] here/ } 171 :child => { :tag => 'td', :content => /Some updated \[\[documentation\]\] here/ }
172 end 172 end
173
174 def test_get_rename
175 @request.session[:user_id] = 2
176 get :rename, :project_id => 1, :id => 'Another_page'
177 assert_response :success
178 assert_template 'rename'
179 assert_tag 'option',
180 :attributes => {:value => ''},
181 :content => '',
182 :parent => {:tag => 'select', :attributes => {:name => 'wiki_page[parent_id]'}}
183 assert_no_tag 'option',
184 :attributes => {:selected => 'selected'},
185 :parent => {:tag => 'select', :attributes => {:name => 'wiki_page[parent_id]'}}
186 end
187
188 def test_get_rename_child_page
189 @request.session[:user_id] = 2
190 get :rename, :project_id => 1, :id => 'Child_1'
191 assert_response :success
192 assert_template 'rename'
193 assert_tag 'option',
194 :attributes => {:value => ''},
195 :content => '',
196 :parent => {:tag => 'select', :attributes => {:name => 'wiki_page[parent_id]'}}
197 assert_tag 'option',
198 :attributes => {:value => '2', :selected => 'selected'},
199 :content => /Another page/,
200 :parent => {
201 :tag => 'select',
202 :attributes => {:name => 'wiki_page[parent_id]'}
203 }
204 end
173 205
174 def test_rename_with_redirect 206 def test_rename_with_redirect
175 @request.session[:user_id] = 2 207 @request.session[:user_id] = 2
176 post :rename, :id => 1, :page => 'Another_page', 208 post :rename, :project_id => 1, :id => 'Another_page',
177 :wiki_page => { :title => 'Another renamed page', 209 :wiki_page => { :title => 'Another renamed page',
178 :redirect_existing_links => 1 } 210 :redirect_existing_links => 1 }
179 assert_redirected_to :action => 'index', :id => 'ecookbook', :page => 'Another_renamed_page' 211 assert_redirected_to :action => 'show', :project_id => 'ecookbook', :id => 'Another_renamed_page'
180 wiki = Project.find(1).wiki 212 wiki = Project.find(1).wiki
181 # Check redirects 213 # Check redirects
182 assert_not_nil wiki.find_page('Another page') 214 assert_not_nil wiki.find_page('Another page')
183 assert_nil wiki.find_page('Another page', :with_redirect => false) 215 assert_nil wiki.find_page('Another page', :with_redirect => false)
184 end 216 end
185 217
186 def test_rename_without_redirect 218 def test_rename_without_redirect
187 @request.session[:user_id] = 2 219 @request.session[:user_id] = 2
188 post :rename, :id => 1, :page => 'Another_page', 220 post :rename, :project_id => 1, :id => 'Another_page',
189 :wiki_page => { :title => 'Another renamed page', 221 :wiki_page => { :title => 'Another renamed page',
190 :redirect_existing_links => "0" } 222 :redirect_existing_links => "0" }
191 assert_redirected_to :action => 'index', :id => 'ecookbook', :page => 'Another_renamed_page' 223 assert_redirected_to :action => 'show', :project_id => 'ecookbook', :id => 'Another_renamed_page'
192 wiki = Project.find(1).wiki 224 wiki = Project.find(1).wiki
193 # Check that there's no redirects 225 # Check that there's no redirects
194 assert_nil wiki.find_page('Another page') 226 assert_nil wiki.find_page('Another page')
195 end 227 end
196 228
229 def test_rename_with_parent_assignment
230 @request.session[:user_id] = 2
231 post :rename, :project_id => 1, :id => 'Another_page',
232 :wiki_page => { :title => 'Another page', :redirect_existing_links => "0", :parent_id => '4' }
233 assert_redirected_to :action => 'show', :project_id => 'ecookbook', :id => 'Another_page'
234 assert_equal WikiPage.find(4), WikiPage.find_by_title('Another_page').parent
235 end
236
237 def test_rename_with_parent_unassignment
238 @request.session[:user_id] = 2
239 post :rename, :project_id => 1, :id => 'Child_1',
240 :wiki_page => { :title => 'Child 1', :redirect_existing_links => "0", :parent_id => '' }
241 assert_redirected_to :action => 'show', :project_id => 'ecookbook', :id => 'Child_1'
242 assert_nil WikiPage.find_by_title('Child_1').parent
243 end
244
197 def test_destroy_child 245 def test_destroy_child
198 @request.session[:user_id] = 2 246 @request.session[:user_id] = 2
199 post :destroy, :id => 1, :page => 'Child_1' 247 delete :destroy, :project_id => 1, :id => 'Child_1'
200 assert_redirected_to :action => 'special', :id => 'ecookbook', :page => 'Page_index' 248 assert_redirected_to :action => 'index', :project_id => 'ecookbook'
201 end 249 end
202 250
203 def test_destroy_parent 251 def test_destroy_parent
204 @request.session[:user_id] = 2 252 @request.session[:user_id] = 2
205 assert_no_difference('WikiPage.count') do 253 assert_no_difference('WikiPage.count') do
206 post :destroy, :id => 1, :page => 'Another_page' 254 delete :destroy, :project_id => 1, :id => 'Another_page'
207 end 255 end
208 assert_response :success 256 assert_response :success
209 assert_template 'destroy' 257 assert_template 'destroy'
210 end 258 end
211 259
212 def test_destroy_parent_with_nullify 260 def test_destroy_parent_with_nullify
213 @request.session[:user_id] = 2 261 @request.session[:user_id] = 2
214 assert_difference('WikiPage.count', -1) do 262 assert_difference('WikiPage.count', -1) do
215 post :destroy, :id => 1, :page => 'Another_page', :todo => 'nullify' 263 delete :destroy, :project_id => 1, :id => 'Another_page', :todo => 'nullify'
216 end 264 end
217 assert_redirected_to :action => 'special', :id => 'ecookbook', :page => 'Page_index' 265 assert_redirected_to :action => 'index', :project_id => 'ecookbook'
218 assert_nil WikiPage.find_by_id(2) 266 assert_nil WikiPage.find_by_id(2)
219 end 267 end
220 268
221 def test_destroy_parent_with_cascade 269 def test_destroy_parent_with_cascade
222 @request.session[:user_id] = 2 270 @request.session[:user_id] = 2
223 assert_difference('WikiPage.count', -3) do 271 assert_difference('WikiPage.count', -3) do
224 post :destroy, :id => 1, :page => 'Another_page', :todo => 'destroy' 272 delete :destroy, :project_id => 1, :id => 'Another_page', :todo => 'destroy'
225 end 273 end
226 assert_redirected_to :action => 'special', :id => 'ecookbook', :page => 'Page_index' 274 assert_redirected_to :action => 'index', :project_id => 'ecookbook'
227 assert_nil WikiPage.find_by_id(2) 275 assert_nil WikiPage.find_by_id(2)
228 assert_nil WikiPage.find_by_id(5) 276 assert_nil WikiPage.find_by_id(5)
229 end 277 end
230 278
231 def test_destroy_parent_with_reassign 279 def test_destroy_parent_with_reassign
232 @request.session[:user_id] = 2 280 @request.session[:user_id] = 2
233 assert_difference('WikiPage.count', -1) do 281 assert_difference('WikiPage.count', -1) do
234 post :destroy, :id => 1, :page => 'Another_page', :todo => 'reassign', :reassign_to_id => 1 282 delete :destroy, :project_id => 1, :id => 'Another_page', :todo => 'reassign', :reassign_to_id => 1
235 end 283 end
236 assert_redirected_to :action => 'special', :id => 'ecookbook', :page => 'Page_index' 284 assert_redirected_to :action => 'index', :project_id => 'ecookbook'
237 assert_nil WikiPage.find_by_id(2) 285 assert_nil WikiPage.find_by_id(2)
238 assert_equal WikiPage.find(1), WikiPage.find_by_id(5).parent 286 assert_equal WikiPage.find(1), WikiPage.find_by_id(5).parent
239 end 287 end
240 288
241 def test_page_index 289 def test_index
242 get :special, :id => 'ecookbook', :page => 'Page_index' 290 get :index, :project_id => 'ecookbook'
243 assert_response :success 291 assert_response :success
244 assert_template 'special_page_index' 292 assert_template 'index'
245 pages = assigns(:pages) 293 pages = assigns(:pages)
246 assert_not_nil pages 294 assert_not_nil pages
247 assert_equal Project.find(1).wiki.pages.size, pages.size 295 assert_equal Project.find(1).wiki.pages.size, pages.size
248 296
249 assert_tag :ul, :attributes => { :class => 'pages-hierarchy' }, 297 assert_tag :ul, :attributes => { :class => 'pages-hierarchy' },
254 :child => { :tag => 'a', :attributes => { :href => '/projects/ecookbook/wiki/Page_with_an_inline_image' }, 302 :child => { :tag => 'a', :attributes => { :href => '/projects/ecookbook/wiki/Page_with_an_inline_image' },
255 :content => 'Page with an inline image' } } } }, 303 :content => 'Page with an inline image' } } } },
256 :child => { :tag => 'li', :child => { :tag => 'a', :attributes => { :href => '/projects/ecookbook/wiki/Another_page' }, 304 :child => { :tag => 'li', :child => { :tag => 'a', :attributes => { :href => '/projects/ecookbook/wiki/Another_page' },
257 :content => 'Another page' } } 305 :content => 'Another page' } }
258 end 306 end
307
308 context "GET :export" do
309 context "with an authorized user to export the wiki" do
310 setup do
311 @request.session[:user_id] = 2
312 get :export, :project_id => 'ecookbook'
313 end
314
315 should_respond_with :success
316 should_assign_to :pages
317 should_respond_with_content_type "text/html"
318 should "export all of the wiki pages to a single html file" do
319 assert_select "a[name=?]", "CookBook_documentation"
320 assert_select "a[name=?]", "Another_page"
321 assert_select "a[name=?]", "Page_with_an_inline_image"
322 end
323
324 end
325
326 context "with an unauthorized user" do
327 setup do
328 get :export, :project_id => 'ecookbook'
329
330 should_respond_with :redirect
331 should_redirect_to('wiki index') { {:action => 'show', :project_id => @project, :id => nil} }
332 end
333 end
334 end
335
336 context "GET :date_index" do
337 setup do
338 get :date_index, :project_id => 'ecookbook'
339 end
340
341 should_respond_with :success
342 should_assign_to :pages
343 should_assign_to :pages_by_date
344 should_render_template 'wiki/date_index'
345
346 end
259 347
260 def test_not_found 348 def test_not_found
261 get :index, :id => 999 349 get :show, :project_id => 999
262 assert_response 404 350 assert_response 404
263 end 351 end
264 352
265 def test_protect_page 353 def test_protect_page
266 page = WikiPage.find_by_wiki_id_and_title(1, 'Another_page') 354 page = WikiPage.find_by_wiki_id_and_title(1, 'Another_page')
267 assert !page.protected? 355 assert !page.protected?
268 @request.session[:user_id] = 2 356 @request.session[:user_id] = 2
269 post :protect, :id => 1, :page => page.title, :protected => '1' 357 post :protect, :project_id => 1, :id => page.title, :protected => '1'
270 assert_redirected_to :action => 'index', :id => 'ecookbook', :page => 'Another_page' 358 assert_redirected_to :action => 'show', :project_id => 'ecookbook', :id => 'Another_page'
271 assert page.reload.protected? 359 assert page.reload.protected?
272 end 360 end
273 361
274 def test_unprotect_page 362 def test_unprotect_page
275 page = WikiPage.find_by_wiki_id_and_title(1, 'CookBook_documentation') 363 page = WikiPage.find_by_wiki_id_and_title(1, 'CookBook_documentation')
276 assert page.protected? 364 assert page.protected?
277 @request.session[:user_id] = 2 365 @request.session[:user_id] = 2
278 post :protect, :id => 1, :page => page.title, :protected => '0' 366 post :protect, :project_id => 1, :id => page.title, :protected => '0'
279 assert_redirected_to :action => 'index', :id => 'ecookbook', :page => 'CookBook_documentation' 367 assert_redirected_to :action => 'show', :project_id => 'ecookbook', :id => 'CookBook_documentation'
280 assert !page.reload.protected? 368 assert !page.reload.protected?
281 end 369 end
282 370
283 def test_show_page_with_edit_link 371 def test_show_page_with_edit_link
284 @request.session[:user_id] = 2 372 @request.session[:user_id] = 2
285 get :index, :id => 1 373 get :show, :project_id => 1
286 assert_response :success 374 assert_response :success
287 assert_template 'show' 375 assert_template 'show'
288 assert_tag :tag => 'a', :attributes => { :href => '/projects/1/wiki/CookBook_documentation/edit' } 376 assert_tag :tag => 'a', :attributes => { :href => '/projects/1/wiki/CookBook_documentation/edit' }
289 end 377 end
290 378
291 def test_show_page_without_edit_link 379 def test_show_page_without_edit_link
292 @request.session[:user_id] = 4 380 @request.session[:user_id] = 4
293 get :index, :id => 1 381 get :show, :project_id => 1
294 assert_response :success 382 assert_response :success
295 assert_template 'show' 383 assert_template 'show'
296 assert_no_tag :tag => 'a', :attributes => { :href => '/projects/1/wiki/CookBook_documentation/edit' } 384 assert_no_tag :tag => 'a', :attributes => { :href => '/projects/1/wiki/CookBook_documentation/edit' }
297 end 385 end
298 386
299 def test_edit_unprotected_page 387 def test_edit_unprotected_page
300 # Non members can edit unprotected wiki pages 388 # Non members can edit unprotected wiki pages
301 @request.session[:user_id] = 4 389 @request.session[:user_id] = 4
302 get :edit, :id => 1, :page => 'Another_page' 390 get :edit, :project_id => 1, :id => 'Another_page'
303 assert_response :success 391 assert_response :success
304 assert_template 'edit' 392 assert_template 'edit'
305 end 393 end
306 394
307 def test_edit_protected_page_by_nonmember 395 def test_edit_protected_page_by_nonmember
308 # Non members can't edit protected wiki pages 396 # Non members can't edit protected wiki pages
309 @request.session[:user_id] = 4 397 @request.session[:user_id] = 4
310 get :edit, :id => 1, :page => 'CookBook_documentation' 398 get :edit, :project_id => 1, :id => 'CookBook_documentation'
311 assert_response 403 399 assert_response 403
312 end 400 end
313 401
314 def test_edit_protected_page_by_member 402 def test_edit_protected_page_by_member
315 @request.session[:user_id] = 2 403 @request.session[:user_id] = 2
316 get :edit, :id => 1, :page => 'CookBook_documentation' 404 get :edit, :project_id => 1, :id => 'CookBook_documentation'
317 assert_response :success 405 assert_response :success
318 assert_template 'edit' 406 assert_template 'edit'
319 end 407 end
320 408
321 def test_history_of_non_existing_page_should_return_404 409 def test_history_of_non_existing_page_should_return_404
322 get :history, :id => 1, :page => 'Unknown_page' 410 get :history, :project_id => 1, :id => 'Unknown_page'
323 assert_response 404 411 assert_response 404
324 end 412 end
325 end 413 end