diff --git a/test/integration/routing_test.rb b/test/integration/routing_test.rb index 580805d64..8f46bb811 100644 --- a/test/integration/routing_test.rb +++ b/test/integration/routing_test.rb @@ -440,34 +440,110 @@ class RoutingTest < ActionController::IntegrationTest should_route :delete, "/news/567/comments/15", :controller => 'comments', :action => 'destroy', :id => '567', :comment_id => '15' end - context "projects" do - should_route :get, "/projects", :controller => 'projects', :action => 'index' - should_route :get, "/projects.atom", :controller => 'projects', :action => 'index', :format => 'atom' - should_route :get, "/projects.xml", :controller => 'projects', :action => 'index', :format => 'xml' - should_route :get, "/projects/new", :controller => 'projects', :action => 'new' - should_route :get, "/projects/test", :controller => 'projects', :action => 'show', :id => 'test' - should_route :get, "/projects/1.xml", :controller => 'projects', :action => 'show', :id => '1', :format => 'xml' - should_route :get, "/projects/4223/settings", :controller => 'projects', :action => 'settings', :id => '4223' - should_route :get, "/projects/4223/settings/members", :controller => 'projects', :action => 'settings', :id => '4223', :tab => 'members' - should_route :get, "/projects/33/files", :controller => 'files', :action => 'index', :project_id => '33' - should_route :get, "/projects/33/files/new", :controller => 'files', :action => 'new', :project_id => '33' - should_route :get, "/projects/33/roadmap", :controller => 'versions', :action => 'index', :project_id => '33' - should_route :get, "/projects/33/activity", :controller => 'activities', :action => 'index', :id => '33' - should_route :get, "/projects/33/activity.atom", :controller => 'activities', :action => 'index', :id => '33', :format => 'atom' - - should_route :post, "/projects", :controller => 'projects', :action => 'create' - should_route :post, "/projects.xml", :controller => 'projects', :action => 'create', :format => 'xml' - should_route :post, "/projects/33/files", :controller => 'files', :action => 'create', :project_id => '33' - should_route :post, "/projects/64/archive", :controller => 'projects', :action => 'archive', :id => '64' - should_route :post, "/projects/64/unarchive", :controller => 'projects', :action => 'unarchive', :id => '64' - - should_route :put, "/projects/64/enumerations", :controller => 'project_enumerations', :action => 'update', :project_id => '64' - should_route :put, "/projects/4223", :controller => 'projects', :action => 'update', :id => '4223' - should_route :put, "/projects/1.xml", :controller => 'projects', :action => 'update', :id => '1', :format => 'xml' - - should_route :delete, "/projects/64", :controller => 'projects', :action => 'destroy', :id => '64' - should_route :delete, "/projects/1.xml", :controller => 'projects', :action => 'destroy', :id => '1', :format => 'xml' - should_route :delete, "/projects/64/enumerations", :controller => 'project_enumerations', :action => 'destroy', :project_id => '64' + def test_projects + assert_routing( + { :method => 'get', :path => "/projects" }, + { :controller => 'projects', :action => 'index' } + ) + assert_routing( + { :method => 'get', :path => "/projects.atom" }, + { :controller => 'projects', :action => 'index', :format => 'atom' } + ) + assert_routing( + { :method => 'get', :path => "/projects.xml" }, + { :controller => 'projects', :action => 'index', :format => 'xml' } + ) + assert_routing( + { :method => 'get', :path => "/projects/new" }, + { :controller => 'projects', :action => 'new' } + ) + assert_routing( + { :method => 'get', :path => "/projects/test" }, + { :controller => 'projects', :action => 'show', :id => 'test' } + ) + assert_routing( + { :method => 'get', :path => "/projects/1.xml" }, + { :controller => 'projects', :action => 'show', :id => '1', + :format => 'xml' } + ) + assert_routing( + { :method => 'get', :path => "/projects/4223/settings" }, + { :controller => 'projects', :action => 'settings', :id => '4223' } + ) + assert_routing( + { :method => 'get', :path => "/projects/4223/settings/members" }, + { :controller => 'projects', :action => 'settings', :id => '4223', + :tab => 'members' } + ) + assert_routing( + { :method => 'get', :path => "/projects/33/files" }, + { :controller => 'files', :action => 'index', :project_id => '33' } + ) + assert_routing( + { :method => 'get', :path => "/projects/33/files/new" }, + { :controller => 'files', :action => 'new', :project_id => '33' } + ) + assert_routing( + { :method => 'get', :path => "/projects/33/roadmap" }, + { :controller => 'versions', :action => 'index', :project_id => '33' } + ) + assert_routing( + { :method => 'get', :path => "/projects/33/activity" }, + { :controller => 'activities', :action => 'index', :id => '33' } + ) + assert_routing( + { :method => 'get', :path => "/projects/33/activity.atom" }, + { :controller => 'activities', :action => 'index', :id => '33', + :format => 'atom' } + ) + assert_routing( + { :method => 'post', :path => "/projects" }, + { :controller => 'projects', :action => 'create' } + ) + assert_routing( + { :method => 'post', :path => "/projects.xml" }, + { :controller => 'projects', :action => 'create', :format => 'xml' } + ) + assert_routing( + { :method => 'post', :path => "/projects/33/files" }, + { :controller => 'files', :action => 'create', :project_id => '33' } + ) + assert_routing( + { :method => 'post', :path => "/projects/64/archive" }, + { :controller => 'projects', :action => 'archive', :id => '64' } + ) + assert_routing( + { :method => 'post', :path => "/projects/64/unarchive" }, + { :controller => 'projects', :action => 'unarchive', :id => '64' } + ) + assert_routing( + { :method => 'put', :path => "/projects/64/enumerations" }, + { :controller => 'project_enumerations', :action => 'update', + :project_id => '64' } + ) + assert_routing( + { :method => 'put', :path => "/projects/4223" }, + { :controller => 'projects', :action => 'update', :id => '4223' } + ) + assert_routing( + { :method => 'put', :path => "/projects/1.xml" }, + { :controller => 'projects', :action => 'update', :id => '1', + :format => 'xml' } + ) + assert_routing( + { :method => 'delete', :path => "/projects/64" }, + { :controller => 'projects', :action => 'destroy', :id => '64' } + ) + assert_routing( + { :method => 'delete', :path => "/projects/1.xml" }, + { :controller => 'projects', :action => 'destroy', :id => '1', + :format => 'xml' } + ) + assert_routing( + { :method => 'delete', :path => "/projects/64/enumerations" }, + { :controller => 'project_enumerations', :action => 'destroy', + :project_id => '64' } + ) end context "queries" do