diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2009-04-21 12:19:56 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2009-04-21 12:19:56 +0000 |
commit | bb44430b631eba1d33b218c97cb5d506073aeb08 (patch) | |
tree | 7e37b43149c5fceebb2a61a08f4c0d814c009615 /test/functional | |
parent | 65cbd94e422ed7119edc474f2c66bdb675f32f98 (diff) | |
download | redmine-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/functional')
-rw-r--r-- | test/functional/wiki_controller_test.rb | 42 |
1 files changed, 40 insertions, 2 deletions
diff --git a/test/functional/wiki_controller_test.rb b/test/functional/wiki_controller_test.rb index 40dc04ae4..22d816e59 100644 --- a/test/functional/wiki_controller_test.rb +++ b/test/functional/wiki_controller_test.rb @@ -240,12 +240,50 @@ class WikiControllerTest < Test::Unit::TestCase ) end - def test_destroy + def test_destroy_child @request.session[:user_id] = 2 - post :destroy, :id => 1, :page => 'CookBook_documentation' + post :destroy, :id => 1, :page => 'Child_1' assert_redirected_to :action => 'special', :id => 'ecookbook', :page => 'Page_index' end + def test_destroy_parent + @request.session[:user_id] = 2 + assert_no_difference('WikiPage.count') do + post :destroy, :id => 1, :page => 'Another_page' + end + assert_response :success + assert_template 'destroy' + end + + def test_destroy_parent_with_nullify + @request.session[:user_id] = 2 + assert_difference('WikiPage.count', -1) do + post :destroy, :id => 1, :page => 'Another_page', :todo => 'nullify' + end + assert_redirected_to :action => 'special', :id => 'ecookbook', :page => 'Page_index' + assert_nil WikiPage.find_by_id(2) + end + + def test_destroy_parent_with_cascade + @request.session[:user_id] = 2 + assert_difference('WikiPage.count', -3) do + post :destroy, :id => 1, :page => 'Another_page', :todo => 'destroy' + end + assert_redirected_to :action => 'special', :id => 'ecookbook', :page => 'Page_index' + assert_nil WikiPage.find_by_id(2) + assert_nil WikiPage.find_by_id(5) + end + + def test_destroy_parent_with_reassign + @request.session[:user_id] = 2 + assert_difference('WikiPage.count', -1) do + post :destroy, :id => 1, :page => 'Another_page', :todo => 'reassign', :reassign_to_id => 1 + end + assert_redirected_to :action => 'special', :id => 'ecookbook', :page => 'Page_index' + assert_nil WikiPage.find_by_id(2) + assert_equal WikiPage.find(1), WikiPage.find_by_id(5).parent + end + def test_special_routing assert_routing( {:method => :get, :path => '/projects/567/wiki/page_index'}, |