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
This commit is contained in:
Toshi MARUYAMA 2011-12-18 08:13:19 +00:00
parent 08c4b22988
commit 2cf2f4964c
1 changed files with 86 additions and 26 deletions

View File

@ -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