##// END OF EJS Templates
Additional tests for WikiController....
Jean-Philippe Lang -
r8142:849463558da4
parent child
Show More
@@ -273,6 +273,26 class WikiControllerTest < ActionController::TestCase
273 273 assert_tag :tag => 'input', :attributes => {:id => 'content_version', :value => '1'}
274 274 end
275 275
276 def test_update_page_with_attachments_only_should_not_create_content_version
277 @request.session[:user_id] = 2
278 assert_no_difference 'WikiPage.count' do
279 assert_no_difference 'WikiContent.count' do
280 assert_no_difference 'WikiContent::Version.count' do
281 assert_difference 'Attachment.count' do
282 put :update, :project_id => 1,
283 :id => 'Another_page',
284 :content => {
285 :comments => '',
286 :text => Wiki.find(1).find_page('Another_page').content.text,
287 :version => 1
288 },
289 :attachments => {'1' => {'file' => uploaded_test_file('testfile.txt', 'text/plain'), 'description' => 'test file'}}
290 end
291 end
292 end
293 end
294 end
295
276 296 def test_update_stale_page_should_not_raise_an_error
277 297 @request.session[:user_id] = 2
278 298 c = Wiki.find(1).find_page('Another_page').content
@@ -736,4 +756,14 class WikiControllerTest < ActionController::TestCase
736 756 get :history, :project_id => 1, :id => 'Unknown_page'
737 757 assert_response 404
738 758 end
759
760 def test_add_attachment
761 @request.session[:user_id] = 2
762 assert_difference 'Attachment.count' do
763 post :add_attachment, :project_id => 1, :id => 'CookBook_documentation',
764 :attachments => {'1' => {'file' => uploaded_test_file('testfile.txt', 'text/plain'), 'description' => 'test file'}}
765 end
766 attachment = Attachment.first(:order => 'id DESC')
767 assert_equal Wiki.find(1).find_page('CookBook_documentation'), attachment.container
768 end
739 769 end
General Comments 0
You need to be logged in to leave comments. Login now