Refactor: Move the rest of the routing tests to RoutingTest.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@3687 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Eric Davis
2010-04-21 16:02:55 +00:00
parent 0fc884cf42
commit 9b595c689d
15 changed files with 167 additions and 702 deletions
-64
View File
@@ -31,20 +31,6 @@ class NewsControllerTest < ActionController::TestCase
User.current = nil
end
def test_index_routing
assert_routing(
{:method => :get, :path => '/news'},
:controller => 'news', :action => 'index'
)
end
def test_index_routing_formatted
assert_routing(
{:method => :get, :path => '/news.atom'},
:controller => 'news', :action => 'index', :format => 'atom'
)
end
def test_index
get :index
assert_response :success
@@ -53,20 +39,6 @@ class NewsControllerTest < ActionController::TestCase
assert_nil assigns(:project)
end
def test_index_with_project_routing
assert_routing(
{:method => :get, :path => '/projects/567/news'},
:controller => 'news', :action => 'index', :project_id => '567'
)
end
def test_index_with_project_routing_formatted
assert_routing(
{:method => :get, :path => '/projects/567/news.atom'},
:controller => 'news', :action => 'index', :project_id => '567', :format => 'atom'
)
end
def test_index_with_project
get :index, :project_id => 1
assert_response :success
@@ -74,13 +46,6 @@ class NewsControllerTest < ActionController::TestCase
assert_not_nil assigns(:newss)
end
def test_show_routing
assert_routing(
{:method => :get, :path => '/news/2'},
:controller => 'news', :action => 'show', :id => '2'
)
end
def test_show
get :show, :id => 1
assert_response :success
@@ -93,17 +58,6 @@ class NewsControllerTest < ActionController::TestCase
assert_response 404
end
def test_new_routing
assert_routing(
{:method => :get, :path => '/projects/567/news/new'},
:controller => 'news', :action => 'new', :project_id => '567'
)
assert_recognizes(
{:controller => 'news', :action => 'new', :project_id => '567'},
{:method => :post, :path => '/projects/567/news'}
)
end
def test_get_new
@request.session[:user_id] = 2
get :new, :project_id => 1
@@ -129,17 +83,6 @@ class NewsControllerTest < ActionController::TestCase
assert_equal 1, ActionMailer::Base.deliveries.size
end
def test_edit_routing
assert_routing(
{:method => :get, :path => '/news/234'},
:controller => 'news', :action => 'show', :id => '234'
)
assert_recognizes(#TODO: PUT to news URI instead, need to modify form
{:controller => 'news', :action => 'edit', :id => '567'},
{:method => :post, :path => '/news/567/edit'}
)
end
def test_get_edit
@request.session[:user_id] = 2
get :edit, :id => 1
@@ -197,13 +140,6 @@ class NewsControllerTest < ActionController::TestCase
assert_equal comments_count - 1, News.find(1).comments.size
end
def test_destroy_routing
assert_recognizes(#TODO: should use DELETE to news URI, need to change form
{:controller => 'news', :action => 'destroy', :id => '567'},
{:method => :post, :path => '/news/567/destroy'}
)
end
def test_destroy
@request.session[:user_id] = 2
post :destroy, :id => 1