test: replace "should_route" of "news" to "assert_routing" at integration/routing_test.rb

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@8261 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Toshi MARUYAMA 2011-12-17 14:49:05 +00:00
parent 06c8bbd342
commit 606c5f3093
1 changed files with 77 additions and 22 deletions

View File

@ -508,28 +508,83 @@ class RoutingTest < ActionController::IntegrationTest
) )
end end
context "news" do def test_news
should_route :get, "/news", :controller => 'news', :action => 'index' assert_routing(
should_route :get, "/news.atom", :controller => 'news', :action => 'index', :format => 'atom' { :method => 'get', :path => "/news" },
should_route :get, "/news.xml", :controller => 'news', :action => 'index', :format => 'xml' { :controller => 'news', :action => 'index' }
should_route :get, "/news.json", :controller => 'news', :action => 'index', :format => 'json' )
should_route :get, "/projects/567/news", :controller => 'news', :action => 'index', :project_id => '567' assert_routing(
should_route :get, "/projects/567/news.atom", :controller => 'news', :action => 'index', :format => 'atom', :project_id => '567' { :method => 'get', :path => "/news.atom" },
should_route :get, "/projects/567/news.xml", :controller => 'news', :action => 'index', :format => 'xml', :project_id => '567' { :controller => 'news', :action => 'index', :format => 'atom' }
should_route :get, "/projects/567/news.json", :controller => 'news', :action => 'index', :format => 'json', :project_id => '567' )
should_route :get, "/news/2", :controller => 'news', :action => 'show', :id => '2' assert_routing(
should_route :get, "/projects/567/news/new", :controller => 'news', :action => 'new', :project_id => '567' { :method => 'get', :path => "/news.xml" },
should_route :get, "/news/234", :controller => 'news', :action => 'show', :id => '234' { :controller => 'news', :action => 'index', :format => 'xml' }
should_route :get, "/news/567/edit", :controller => 'news', :action => 'edit', :id => '567' )
should_route :get, "/news/preview", :controller => 'previews', :action => 'news' assert_routing(
{ :method => 'get', :path => "/news.json" },
should_route :post, "/projects/567/news", :controller => 'news', :action => 'create', :project_id => '567' { :controller => 'news', :action => 'index', :format => 'json' }
should_route :post, "/news/567/comments", :controller => 'comments', :action => 'create', :id => '567' )
assert_routing(
should_route :put, "/news/567", :controller => 'news', :action => 'update', :id => '567' { :method => 'get', :path => "/projects/567/news" },
{ :controller => 'news', :action => 'index', :project_id => '567' }
should_route :delete, "/news/567", :controller => 'news', :action => 'destroy', :id => '567' )
should_route :delete, "/news/567/comments/15", :controller => 'comments', :action => 'destroy', :id => '567', :comment_id => '15' assert_routing(
{ :method => 'get', :path => "/projects/567/news.atom" },
{ :controller => 'news', :action => 'index', :format => 'atom',
:project_id => '567' }
)
assert_routing(
{ :method => 'get', :path => "/projects/567/news.xml" },
{ :controller => 'news', :action => 'index', :format => 'xml',
:project_id => '567' }
)
assert_routing(
{ :method => 'get', :path => "/projects/567/news.json" },
{ :controller => 'news', :action => 'index', :format => 'json',
:project_id => '567' }
)
assert_routing(
{ :method => 'get', :path => "/news/2" },
{ :controller => 'news', :action => 'show', :id => '2' }
)
assert_routing(
{ :method => 'get', :path => "/projects/567/news/new" },
{ :controller => 'news', :action => 'new', :project_id => '567' }
)
assert_routing(
{ :method => 'get', :path => "/news/234" },
{ :controller => 'news', :action => 'show', :id => '234' }
)
assert_routing(
{ :method => 'get', :path => "/news/567/edit" },
{ :controller => 'news', :action => 'edit', :id => '567' }
)
assert_routing(
{ :method => 'get', :path => "/news/preview" },
{ :controller => 'previews', :action => 'news' }
)
assert_routing(
{ :method => 'post', :path => "/projects/567/news" },
{ :controller => 'news', :action => 'create', :project_id => '567' }
)
assert_routing(
{ :method => 'post', :path => "/news/567/comments" },
{ :controller => 'comments', :action => 'create', :id => '567' }
)
assert_routing(
{ :method => 'put', :path => "/news/567" },
{ :controller => 'news', :action => 'update', :id => '567' }
)
assert_routing(
{ :method => 'delete', :path => "/news/567" },
{ :controller => 'news', :action => 'destroy', :id => '567' }
)
assert_routing(
{ :method => 'delete', :path => "/news/567/comments/15" },
{ :controller => 'comments', :action => 'destroy', :id => '567',
:comment_id => '15' }
)
end end
def test_projects def test_projects