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