summaryrefslogtreecommitdiffstats
path: root/test/unit
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2009-04-21 12:19:56 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2009-04-21 12:19:56 +0000
commitbb44430b631eba1d33b218c97cb5d506073aeb08 (patch)
tree7e37b43149c5fceebb2a61a08f4c0d814c009615 /test/unit
parent65cbd94e422ed7119edc474f2c66bdb675f32f98 (diff)
downloadredmine-bb44430b631eba1d33b218c97cb5d506073aeb08.tar.gz
redmine-bb44430b631eba1d33b218c97cb5d506073aeb08.zip
Ask user what to do with child pages when deleting a parent wiki page (#3202).
3 options are available: * move child pages as root pages * move child pages to another parent page * delete all descendants git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@2676 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/unit')
-rw-r--r--test/unit/wiki_page_test.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/test/unit/wiki_page_test.rb b/test/unit/wiki_page_test.rb
index f7f62aec4..df41a4a0a 100644
--- a/test/unit/wiki_page_test.rb
+++ b/test/unit/wiki_page_test.rb
@@ -100,4 +100,18 @@ class WikiPageTest < Test::Unit::TestCase
assert WikiContent.find_all_by_page_id(1).empty?
assert WikiContent.versioned_class.find_all_by_page_id(1).empty?
end
+
+ def test_destroy_should_not_nullify_children
+ page = WikiPage.find(2)
+ child_ids = page.child_ids
+ assert child_ids.any?
+ page.destroy
+ assert_nil WikiPage.find_by_id(2)
+
+ children = WikiPage.find_all_by_id(child_ids)
+ assert_equal child_ids.size, children.size
+ children.each do |child|
+ assert_nil child.parent_id
+ end
+ end
end