summaryrefslogtreecommitdiffstats
path: root/test/unit/wiki_page_test.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2014-11-23 13:36:01 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2014-11-23 13:36:01 +0000
commite0a034164f3409336f686cfa381da8a5db15c40e (patch)
treee4bd9590116c03026375a3ae5c618e01cd7bddc3 /test/unit/wiki_page_test.rb
parent1ada789a6ccbbbaa55adc3a661ea7cef917d4b71 (diff)
downloadredmine-e0a034164f3409336f686cfa381da8a5db15c40e.tar.gz
redmine-e0a034164f3409336f686cfa381da8a5db15c40e.zip
Move wiki page to other project (#5450).
git-svn-id: http://svn.redmine.org/redmine/trunk@13643 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/unit/wiki_page_test.rb')
-rw-r--r--test/unit/wiki_page_test.rb20
1 files changed, 20 insertions, 0 deletions
diff --git a/test/unit/wiki_page_test.rb b/test/unit/wiki_page_test.rb
index a8c56678d..d3453583c 100644
--- a/test/unit/wiki_page_test.rb
+++ b/test/unit/wiki_page_test.rb
@@ -101,6 +101,26 @@ class WikiPageTest < ActiveSupport::TestCase
assert page.save
end
+ def test_move_child_should_clear_parent
+ parent = WikiPage.create!(:wiki_id => 1, :title => 'Parent')
+ child = WikiPage.create!(:wiki_id => 1, :title => 'Child', :parent => parent)
+
+ child.wiki_id = 2
+ child.save!
+ assert_equal nil, child.reload.parent_id
+ end
+
+ def test_move_parent_should_move_child_page
+ parent = WikiPage.create!(:wiki_id => 1, :title => 'Parent')
+ child = WikiPage.create!(:wiki_id => 1, :title => 'Child', :parent => parent)
+ parent.reload
+
+ parent.wiki_id = 2
+ parent.save!
+ assert_equal 2, child.reload.wiki_id
+ assert_equal parent, child.parent
+ end
+
def test_destroy
page = WikiPage.find(1)
page.destroy