Corrected error handling by admin/remove_orphaned_pages

This commit is contained in:
Alexey Verkhovsky 2005-05-09 03:52:43 +00:00
parent b3e355f4bc
commit 757e58b94f
2 changed files with 15 additions and 2 deletions

View file

@ -87,8 +87,8 @@ class AdminController < ApplicationController
flash[:info] = 'Orphaned pages removed'
redirect_to :controller => 'wiki', :web => @web_name, :action => 'list'
else
flash[:error] = password_error(@params['system_password'])
return_to_last_remembered
flash[:error] = password_error(@params['system_password_orphaned'])
redirect_to :controller => 'admin', :web => @web_name, :action => 'edit_web'
end
end

View file

@ -212,4 +212,17 @@ class AdminControllerTest < Test::Unit::TestCase
"Pages are not as expected: #{@web.select.sort.map {|p| p.name}.inspect}"
end
def test_remove_orphaned_pages_empty_or_wrong_password
setup_wiki_with_three_pages
@wiki.system[:password] = 'pswd'
process('remove_orphaned_pages', 'web' => 'wiki1')
assert_redirected_to(:controller => 'admin', :action => 'edit_web', :web => 'wiki1')
assert @response.flash[:error]
process('remove_orphaned_pages', 'web' => 'wiki1', 'system_password_orphaned' => 'wrong')
assert_redirected_to(:controller => 'admin', :action => 'edit_web', :web => 'wiki1')
assert @response.flash[:error]
end
end