Corrected error handling by admin/remove_orphaned_pages
This commit is contained in:
parent
b3e355f4bc
commit
757e58b94f
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue