diff --git a/app/views/admin/edit_web.rhtml b/app/views/admin/edit_web.rhtml index 20630650..8d482cbd 100644 --- a/app/views/admin/edit_web.rhtml +++ b/app/views/admin/edit_web.rhtml @@ -118,7 +118,7 @@ 'accept-charset' => 'utf-8' }) do %>
- Clean up this Web by entering the system password + Clean up this web (<%= @web.name %>) by entering the system password and @@ -152,7 +152,7 @@ 'accept-charset' => 'utf-8' }) do %>
- Delete this Web, and all its pages. Enter system password
+ Delete this web (<%= @web.name %>), and all its pages. Enter system password
and
diff --git a/test/functional/admin_controller_test.rb b/test/functional/admin_controller_test.rb
index b8594572..bb449c53 100644
--- a/test/functional/admin_controller_test.rb
+++ b/test/functional/admin_controller_test.rb
@@ -226,6 +226,47 @@ class AdminControllerTest < Test::Unit::TestCase
"Pages are not as expected: #{@web.select.sort.map {|p| p.name}.inspect}"
end
+ def test_remove_orphaned_pages_in_category
+ @wiki.system.update_attribute(:password, 'pswd')
+ page_order = [pages(:elephant), pages(:first_page), @home, pages(:my_way), pages(:no_wiki_word), @oak, pages(:smart_engine), pages(:that_way)]
+ orphan_page_linking_to_oak = @wiki.write_page('wiki1', 'Pine',
+ "Refers to [[Oak]].\n" +
+ "category: trees",
+ Time.now, Author.new('TreeHugger', '127.0.0.2'), test_renderer)
+
+ r = process('remove_orphaned_pages_in_category', 'web' => 'wiki1', 'category' => 'trees','system_password_orphaned_in_category' => 'pswd')
+
+ assert_redirected_to :controller => 'wiki', :web => 'wiki1', :action => 'list'
+ @web.pages(true)
+ assert_equal page_order, @web.select.sort,
+ "Pages are not as expected: #{@web.select.sort.map {|p| p.name}.inspect}"
+
+ # Oak is now orphan, but it's not in the 'animals' category,
+ # so the second pass should not remove it
+ r = process('remove_orphaned_pages_in_category', 'web' => 'wiki1', 'category' => 'animals', 'system_password_orphaned_in_category' => 'pswd')
+ assert_redirected_to :controller => 'wiki', :web => 'wiki1', :action => 'list'
+ @web.pages(true)
+ page_order.delete(pages(:elephant))
+ assert_equal page_order, @web.select.sort,
+ "Pages are not as expected: #{@web.select.sort.map {|p| p.name}.inspect}"
+
+ # third pass does does nothing, since there are no pages in the
+ # 'leaves' category.
+ r = process('remove_orphaned_pages_in_category', 'web' => 'wiki1', 'category' => 'leaves', 'system_password_orphaned_in_category' => 'pswd')
+ assert_redirected_to :action => 'list'
+ @web.pages(true)
+ assert_equal page_order, @web.select.sort,
+ "Pages are not as expected: #{@web.select.sort.map {|p| p.name}.inspect}"
+
+ # fourth pass destroys Oak
+ r = process('remove_orphaned_pages_in_category', 'web' => 'wiki1', 'category' => 'trees', 'system_password_orphaned_in_category' => 'pswd')
+ assert_redirected_to :action => 'list'
+ @web.pages(true)
+ page_order.delete(@oak)
+ assert_equal page_order, @web.select.sort,
+ "Pages are not as expected: #{@web.select.sort.map {|p| p.name}.inspect}"
+ end
+
def test_remove_orphaned_pages_empty_or_wrong_password
@wiki.system[:password] = 'pswd'
diff --git a/test/unit/chunks/nowiki_test.rb b/test/unit/chunks/nowiki_test.rb
index f1f8e75b..b7104751 100755
--- a/test/unit/chunks/nowiki_test.rb
+++ b/test/unit/chunks/nowiki_test.rb
@@ -30,4 +30,10 @@ class NoWikiTest < Test::Unit::TestCase
)
end
+ def test_sanitize_nowiki_ill_formed_II
+ match(NoWiki, "