Refactor: extract #page_index from WikiController#special

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@4253 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Eric Davis
2010-10-15 15:36:10 +00:00
parent bbbfd4ee4c
commit 0271105794
7 changed files with 17 additions and 13 deletions
+6 -6
View File
@@ -197,7 +197,7 @@ class WikiControllerTest < ActionController::TestCase
def test_destroy_child
@request.session[:user_id] = 2
post :destroy, :id => 1, :page => 'Child_1'
assert_redirected_to :action => 'special', :id => 'ecookbook', :page => 'Page_index'
assert_redirected_to :action => 'page_index', :id => 'ecookbook'
end
def test_destroy_parent
@@ -214,7 +214,7 @@ class WikiControllerTest < ActionController::TestCase
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_redirected_to :action => 'page_index', :id => 'ecookbook'
assert_nil WikiPage.find_by_id(2)
end
@@ -223,7 +223,7 @@ class WikiControllerTest < ActionController::TestCase
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_redirected_to :action => 'page_index', :id => 'ecookbook'
assert_nil WikiPage.find_by_id(2)
assert_nil WikiPage.find_by_id(5)
end
@@ -233,15 +233,15 @@ class WikiControllerTest < ActionController::TestCase
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_redirected_to :action => 'page_index', :id => 'ecookbook'
assert_nil WikiPage.find_by_id(2)
assert_equal WikiPage.find(1), WikiPage.find_by_id(5).parent
end
def test_page_index
get :special, :id => 'ecookbook', :page => 'Page_index'
get :page_index, :id => 'ecookbook'
assert_response :success
assert_template 'special_page_index'
assert_template 'page_index'
pages = assigns(:pages)
assert_not_nil pages
assert_equal Project.find(1).wiki.pages.size, pages.size
+1 -2
View File
@@ -318,8 +318,7 @@ class RoutingTest < ActionController::IntegrationTest
should_route :get, "/projects/1/wiki/CookBook_documentation/diff/2/vs/1", :controller => 'wiki', :action => 'diff', :id => '1', :page => 'CookBook_documentation', :version => '2', :version_from => '1'
should_route :get, "/projects/1/wiki/CookBook_documentation/annotate/2", :controller => 'wiki', :action => 'annotate', :id => '1', :page => 'CookBook_documentation', :version => '2'
should_route :get, "/projects/22/wiki/ladida/rename", :controller => 'wiki', :action => 'rename', :id => '22', :page => 'ladida'
should_route :get, "/projects/567/wiki/page_index", :controller => 'wiki', :action => 'special', :id => '567', :page => 'page_index'
should_route :get, "/projects/567/wiki/Page_Index", :controller => 'wiki', :action => 'special', :id => '567', :page => 'Page_Index'
should_route :get, "/projects/567/wiki/page_index", :controller => 'wiki', :action => 'page_index', :id => '567'
should_route :get, "/projects/567/wiki/date_index", :controller => 'wiki', :action => 'special', :id => '567', :page => 'date_index'
should_route :get, "/projects/567/wiki/export", :controller => 'wiki', :action => 'export', :id => '567'