@@ -270,9 +270,12 class WikiController < ApplicationController | |||
|
270 | 270 | def destroy_version |
|
271 | 271 | return render_403 unless editable? |
|
272 | 272 | |
|
273 |
|
|
|
274 |
|
|
|
275 | redirect_to_referer_or history_project_wiki_page_path(@project, @page.title) | |
|
273 | if content = @page.content.versions.find_by_version(params[:version]) | |
|
274 | content.destroy | |
|
275 | redirect_to_referer_or history_project_wiki_page_path(@project, @page.title) | |
|
276 | else | |
|
277 | render_404 | |
|
278 | end | |
|
276 | 279 | end |
|
277 | 280 | |
|
278 | 281 | # Export wiki to a single pdf or html file |
@@ -757,6 +757,18 class WikiControllerTest < ActionController::TestCase | |||
|
757 | 757 | end |
|
758 | 758 | end |
|
759 | 759 | |
|
760 | def test_destroy_invalid_version_should_respond_with_404 | |
|
761 | @request.session[:user_id] = 2 | |
|
762 | assert_no_difference 'WikiContent::Version.count' do | |
|
763 | assert_no_difference 'WikiContent.count' do | |
|
764 | assert_no_difference 'WikiPage.count' do | |
|
765 | delete :destroy_version, :project_id => 'ecookbook', :id => 'CookBook_documentation', :version => 99 | |
|
766 | end | |
|
767 | end | |
|
768 | end | |
|
769 | assert_response 404 | |
|
770 | end | |
|
771 | ||
|
760 | 772 | def test_index |
|
761 | 773 | get :index, :project_id => 'ecookbook' |
|
762 | 774 | assert_response :success |
General Comments 0
You need to be logged in to leave comments.
Login now