From: Toshi MARUYAMA Date: Sun, 18 Dec 2011 08:13:19 +0000 (+0000) Subject: test: replace "should_route" of "versions" to "assert_routing" at integration/routing... X-Git-Tag: 1.4.0~1013 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=2cf2f4964c103c24a219391831e6add6188e498b;p=redmine.git test: replace "should_route" of "versions" to "assert_routing" at integration/routing_test.rb git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@8274 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- diff --git a/test/integration/routing_test.rb b/test/integration/routing_test.rb index 28558f18d..a83ff6006 100644 --- a/test/integration/routing_test.rb +++ b/test/integration/routing_test.rb @@ -1192,33 +1192,93 @@ class RoutingTest < ActionController::IntegrationTest ) end - context "versions" do + def test_versions # /projects/foo/versions is /projects/foo/roadmap - should_route :get, "/projects/foo/versions.xml", :controller => 'versions', :action => 'index', :project_id => 'foo', :format => 'xml' - should_route :get, "/projects/foo/versions.json", :controller => 'versions', :action => 'index', :project_id => 'foo', :format => 'json' - - should_route :get, "/projects/foo/versions/new", :controller => 'versions', :action => 'new', :project_id => 'foo' - - should_route :post, "/projects/foo/versions", :controller => 'versions', :action => 'create', :project_id => 'foo' - should_route :post, "/projects/foo/versions.xml", :controller => 'versions', :action => 'create', :project_id => 'foo', :format => 'xml' - should_route :post, "/projects/foo/versions.json", :controller => 'versions', :action => 'create', :project_id => 'foo', :format => 'json' - - should_route :get, "/versions/1", :controller => 'versions', :action => 'show', :id => '1' - should_route :get, "/versions/1.xml", :controller => 'versions', :action => 'show', :id => '1', :format => 'xml' - should_route :get, "/versions/1.json", :controller => 'versions', :action => 'show', :id => '1', :format => 'json' - - should_route :get, "/versions/1/edit", :controller => 'versions', :action => 'edit', :id => '1' - - should_route :put, "/versions/1", :controller => 'versions', :action => 'update', :id => '1' - should_route :put, "/versions/1.xml", :controller => 'versions', :action => 'update', :id => '1', :format => 'xml' - should_route :put, "/versions/1.json", :controller => 'versions', :action => 'update', :id => '1', :format => 'json' - - should_route :delete, "/versions/1", :controller => 'versions', :action => 'destroy', :id => '1' - should_route :delete, "/versions/1.xml", :controller => 'versions', :action => 'destroy', :id => '1', :format => 'xml' - should_route :delete, "/versions/1.json", :controller => 'versions', :action => 'destroy', :id => '1', :format => 'json' - - should_route :put, "/projects/foo/versions/close_completed", :controller => 'versions', :action => 'close_completed', :project_id => 'foo' - should_route :post, "/versions/1/status_by", :controller => 'versions', :action => 'status_by', :id => '1' + assert_routing( + { :method => 'get', :path => "/projects/foo/versions.xml" }, + { :controller => 'versions', :action => 'index', + :project_id => 'foo', :format => 'xml' } + ) + assert_routing( + { :method => 'get', :path => "/projects/foo/versions.json" }, + { :controller => 'versions', :action => 'index', + :project_id => 'foo', :format => 'json' } + ) + assert_routing( + { :method => 'get', :path => "/projects/foo/versions/new" }, + { :controller => 'versions', :action => 'new', + :project_id => 'foo' } + ) + assert_routing( + { :method => 'post', :path => "/projects/foo/versions" }, + { :controller => 'versions', :action => 'create', + :project_id => 'foo' } + ) + assert_routing( + { :method => 'post', :path => "/projects/foo/versions.xml" }, + { :controller => 'versions', :action => 'create', + :project_id => 'foo', :format => 'xml' } + ) + assert_routing( + { :method => 'post', :path => "/projects/foo/versions.json" }, + { :controller => 'versions', :action => 'create', + :project_id => 'foo', :format => 'json' } + ) + assert_routing( + { :method => 'get', :path => "/versions/1" }, + { :controller => 'versions', :action => 'show', :id => '1' } + ) + assert_routing( + { :method => 'get', :path => "/versions/1.xml" }, + { :controller => 'versions', :action => 'show', :id => '1', + :format => 'xml' } + ) + assert_routing( + { :method => 'get', :path => "/versions/1.json" }, + { :controller => 'versions', :action => 'show', :id => '1', + :format => 'json' } + ) + assert_routing( + { :method => 'get', :path => "/versions/1/edit" }, + { :controller => 'versions', :action => 'edit', :id => '1' } + ) + assert_routing( + { :method => 'put', :path => "/versions/1" }, + { :controller => 'versions', :action => 'update', :id => '1' } + ) + assert_routing( + { :method => 'put', :path => "/versions/1.xml" }, + { :controller => 'versions', :action => 'update', :id => '1', + :format => 'xml' } + ) + assert_routing( + { :method => 'put', :path => "/versions/1.json" }, + { :controller => 'versions', :action => 'update', :id => '1', + :format => 'json' } + ) + assert_routing( + { :method => 'delete', :path => "/versions/1" }, + { :controller => 'versions', :action => 'destroy', :id => '1' } + ) + assert_routing( + { :method => 'delete', :path => "/versions/1.xml" }, + { :controller => 'versions', :action => 'destroy', :id => '1', + :format => 'xml' } + ) + assert_routing( + { :method => 'delete', :path => "/versions/1.json" }, + { :controller => 'versions', :action => 'destroy', :id => '1', + :format => 'json' } + ) + assert_routing( + { :method => 'put', :path => "/projects/foo/versions/close_completed" }, + { :controller => 'versions', :action => 'close_completed', + :project_id => 'foo' } + ) + assert_routing( + { :method => 'post', :path => "/versions/1/status_by" }, + { :controller => 'versions', :action => 'status_by', :id => '1' } + ) end def test_welcome