Move more routing tests into the routing integration test.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@3686 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
@@ -31,21 +31,6 @@ class WikiControllerTest < ActionController::TestCase
|
||||
User.current = nil
|
||||
end
|
||||
|
||||
def test_index_routing
|
||||
assert_routing(
|
||||
{:method => :get, :path => '/projects/567/wiki'},
|
||||
:controller => 'wiki', :action => 'index', :id => '567'
|
||||
)
|
||||
assert_routing(
|
||||
{:method => :get, :path => '/projects/567/wiki/lalala'},
|
||||
:controller => 'wiki', :action => 'index', :id => '567', :page => 'lalala'
|
||||
)
|
||||
assert_generates(
|
||||
'/projects/567/wiki',
|
||||
:controller => 'wiki', :action => 'index', :id => '567', :page => nil
|
||||
)
|
||||
end
|
||||
|
||||
def test_show_start_page
|
||||
get :index, :id => 'ecookbook'
|
||||
assert_response :success
|
||||
@@ -93,17 +78,6 @@ class WikiControllerTest < ActionController::TestCase
|
||||
assert_template 'edit'
|
||||
end
|
||||
|
||||
def test_edit_routing
|
||||
assert_routing(
|
||||
{:method => :get, :path => '/projects/567/wiki/my_page/edit'},
|
||||
:controller => 'wiki', :action => 'edit', :id => '567', :page => 'my_page'
|
||||
)
|
||||
assert_recognizes(#TODO: use PUT to page path, adjust forms accordingly
|
||||
{:controller => 'wiki', :action => 'edit', :id => '567', :page => 'my_page'},
|
||||
{:method => :post, :path => '/projects/567/wiki/my_page/edit'}
|
||||
)
|
||||
end
|
||||
|
||||
def test_create_page
|
||||
@request.session[:user_id] = 2
|
||||
post :edit, :id => 1,
|
||||
@@ -135,13 +109,6 @@ class WikiControllerTest < ActionController::TestCase
|
||||
assert_equal 'testfile.txt', page.attachments.first.filename
|
||||
end
|
||||
|
||||
def test_preview_routing
|
||||
assert_routing(
|
||||
{:method => :post, :path => '/projects/567/wiki/CookBook_documentation/preview'},
|
||||
:controller => 'wiki', :action => 'preview', :id => '567', :page => 'CookBook_documentation'
|
||||
)
|
||||
end
|
||||
|
||||
def test_preview
|
||||
@request.session[:user_id] = 2
|
||||
xhr :post, :preview, :id => 1, :page => 'CookBook_documentation',
|
||||
@@ -164,13 +131,6 @@ class WikiControllerTest < ActionController::TestCase
|
||||
assert_tag :tag => 'h1', :content => /New page/
|
||||
end
|
||||
|
||||
def test_history_routing
|
||||
assert_routing(
|
||||
{:method => :get, :path => '/projects/1/wiki/CookBook_documentation/history'},
|
||||
:controller => 'wiki', :action => 'history', :id => '1', :page => 'CookBook_documentation'
|
||||
)
|
||||
end
|
||||
|
||||
def test_history
|
||||
get :history, :id => 1, :page => 'CookBook_documentation'
|
||||
assert_response :success
|
||||
@@ -189,13 +149,6 @@ class WikiControllerTest < ActionController::TestCase
|
||||
assert_select "input[type=submit][name=commit]", false
|
||||
end
|
||||
|
||||
def test_diff_routing
|
||||
assert_routing(
|
||||
{:method => :get, :path => '/projects/1/wiki/CookBook_documentation/diff/2/vs/1'},
|
||||
:controller => 'wiki', :action => 'diff', :id => '1', :page => 'CookBook_documentation', :version => '2', :version_from => '1'
|
||||
)
|
||||
end
|
||||
|
||||
def test_diff
|
||||
get :diff, :id => 1, :page => 'CookBook_documentation', :version => 2, :version_from => 1
|
||||
assert_response :success
|
||||
@@ -204,13 +157,6 @@ class WikiControllerTest < ActionController::TestCase
|
||||
:content => /updated/
|
||||
end
|
||||
|
||||
def test_annotate_routing
|
||||
assert_routing(
|
||||
{:method => :get, :path => '/projects/1/wiki/CookBook_documentation/annotate/2'},
|
||||
:controller => 'wiki', :action => 'annotate', :id => '1', :page => 'CookBook_documentation', :version => '2'
|
||||
)
|
||||
end
|
||||
|
||||
def test_annotate
|
||||
get :annotate, :id => 1, :page => 'CookBook_documentation', :version => 2
|
||||
assert_response :success
|
||||
@@ -225,18 +171,6 @@ class WikiControllerTest < ActionController::TestCase
|
||||
:child => { :tag => 'td', :content => /Some updated \[\[documentation\]\] here/ }
|
||||
end
|
||||
|
||||
def test_rename_routing
|
||||
assert_routing(
|
||||
{:method => :get, :path => '/projects/22/wiki/ladida/rename'},
|
||||
:controller => 'wiki', :action => 'rename', :id => '22', :page => 'ladida'
|
||||
)
|
||||
assert_recognizes(
|
||||
#TODO: should be moved into a update action and use a PUT to the page URI
|
||||
{:controller => 'wiki', :action => 'rename', :id => '22', :page => 'ladida'},
|
||||
{:method => :post, :path => '/projects/22/wiki/ladida/rename'}
|
||||
)
|
||||
end
|
||||
|
||||
def test_rename_with_redirect
|
||||
@request.session[:user_id] = 2
|
||||
post :rename, :id => 1, :page => 'Another_page',
|
||||
@@ -260,14 +194,6 @@ class WikiControllerTest < ActionController::TestCase
|
||||
assert_nil wiki.find_page('Another page')
|
||||
end
|
||||
|
||||
def test_destroy_routing
|
||||
assert_recognizes(
|
||||
#TODO: should use DELETE on page URI
|
||||
{:controller => 'wiki', :action => 'destroy', :id => '22', :page => 'ladida'},
|
||||
{:method => :post, :path => 'projects/22/wiki/ladida/destroy'}
|
||||
)
|
||||
end
|
||||
|
||||
def test_destroy_child
|
||||
@request.session[:user_id] = 2
|
||||
post :destroy, :id => 1, :page => 'Child_1'
|
||||
@@ -312,25 +238,6 @@ class WikiControllerTest < ActionController::TestCase
|
||||
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'},
|
||||
:controller => 'wiki', :action => 'special', :id => '567', :page => 'page_index'
|
||||
)
|
||||
assert_routing(
|
||||
{:method => :get, :path => '/projects/567/wiki/Page_Index'},
|
||||
:controller => 'wiki', :action => 'special', :id => '567', :page => 'Page_Index'
|
||||
)
|
||||
assert_routing(
|
||||
{:method => :get, :path => '/projects/567/wiki/date_index'},
|
||||
:controller => 'wiki', :action => 'special', :id => '567', :page => 'date_index'
|
||||
)
|
||||
assert_routing(
|
||||
{:method => :get, :path => '/projects/567/wiki/export'},
|
||||
:controller => 'wiki', :action => 'special', :id => '567', :page => 'export'
|
||||
)
|
||||
end
|
||||
|
||||
def test_page_index
|
||||
get :special, :id => 'ecookbook', :page => 'Page_index'
|
||||
assert_response :success
|
||||
@@ -355,13 +262,6 @@ class WikiControllerTest < ActionController::TestCase
|
||||
assert_response 404
|
||||
end
|
||||
|
||||
def test_protect_routing
|
||||
assert_routing(
|
||||
{:method => :post, :path => 'projects/22/wiki/ladida/protect'},
|
||||
{:controller => 'wiki', :action => 'protect', :id => '22', :page => 'ladida'}
|
||||
)
|
||||
end
|
||||
|
||||
def test_protect_page
|
||||
page = WikiPage.find_by_wiki_id_and_title(1, 'Another_page')
|
||||
assert !page.protected?
|
||||
|
||||
Reference in New Issue
Block a user