From 4d2a832fb663b91722543b0b1b0af7f39ef44124 2011-12-15 05:11:04 From: Toshi MARUYAMA Date: 2011-12-15 05:11:04 Subject: [PATCH] test: replace "should_route" of "issues" REST actions to "assert_routing" at integration/routing_test.rb git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@8219 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- diff --git a/test/integration/routing_test.rb b/test/integration/routing_test.rb index 64381c7..1f0d09a 100644 --- a/test/integration/routing_test.rb +++ b/test/integration/routing_test.rb @@ -150,22 +150,68 @@ class RoutingTest < ActionController::IntegrationTest should_route :delete, "/groups/567/users/12", :controller => 'groups', :action => 'remove_user', :id => '567', :user_id => '12' end + def test_issues_rest_actions + assert_routing( + { :method => 'get', :path => "/issues" }, + { :controller => 'issues', :action => 'index' } + ) + assert_routing( + { :method => 'get', :path => "/issues.pdf" }, + { :controller => 'issues', :action => 'index', :format => 'pdf' } + ) + assert_routing( + { :method => 'get', :path => "/issues.atom" }, + { :controller => 'issues', :action => 'index', :format => 'atom' } + ) + assert_routing( + { :method => 'get', :path => "/issues.xml" }, + { :controller => 'issues', :action => 'index', :format => 'xml' } + ) + assert_routing( + { :method => 'get', :path => "/projects/23/issues" }, + { :controller => 'issues', :action => 'index', :project_id => '23' } + ) + assert_routing( + { :method => 'get', :path => "/projects/23/issues.pdf" }, + { :controller => 'issues', :action => 'index', :project_id => '23', + :format => 'pdf' } + ) + assert_routing( + { :method => 'get', :path => "/projects/23/issues.atom" }, + { :controller => 'issues', :action => 'index', :project_id => '23', + :format => 'atom' } + ) + assert_routing( + { :method => 'get', :path => "/projects/23/issues.xml" }, + { :controller => 'issues', :action => 'index', :project_id => '23', + :format => 'xml' } + ) + assert_routing( + { :method => 'get', :path => "/issues/64" }, + { :controller => 'issues', :action => 'show', :id => '64' } + ) + assert_routing( + { :method => 'get', :path => "/issues/64.pdf" }, + { :controller => 'issues', :action => 'show', :id => '64', + :format => 'pdf' } + ) + assert_routing( + { :method => 'get', :path => "/issues/64.atom" }, + { :controller => 'issues', :action => 'show', :id => '64', + :format => 'atom' } + ) + assert_routing( + { :method => 'get', :path => "/issues/64.xml" }, + { :controller => 'issues', :action => 'show', :id => '64', + :format => 'xml' } + ) + assert_routing( + { :method => 'get', :path => "/projects/23/issues/new" }, + { :controller => 'issues', :action => 'new', :project_id => '23' } + ) + end + context "issues" do - # REST actions - should_route :get, "/issues", :controller => 'issues', :action => 'index' - should_route :get, "/issues.pdf", :controller => 'issues', :action => 'index', :format => 'pdf' - should_route :get, "/issues.atom", :controller => 'issues', :action => 'index', :format => 'atom' - should_route :get, "/issues.xml", :controller => 'issues', :action => 'index', :format => 'xml' - should_route :get, "/projects/23/issues", :controller => 'issues', :action => 'index', :project_id => '23' - should_route :get, "/projects/23/issues.pdf", :controller => 'issues', :action => 'index', :project_id => '23', :format => 'pdf' - should_route :get, "/projects/23/issues.atom", :controller => 'issues', :action => 'index', :project_id => '23', :format => 'atom' - should_route :get, "/projects/23/issues.xml", :controller => 'issues', :action => 'index', :project_id => '23', :format => 'xml' - should_route :get, "/issues/64", :controller => 'issues', :action => 'show', :id => '64' - should_route :get, "/issues/64.pdf", :controller => 'issues', :action => 'show', :id => '64', :format => 'pdf' - should_route :get, "/issues/64.atom", :controller => 'issues', :action => 'show', :id => '64', :format => 'atom' - should_route :get, "/issues/64.xml", :controller => 'issues', :action => 'show', :id => '64', :format => 'xml' - - should_route :get, "/projects/23/issues/new", :controller => 'issues', :action => 'new', :project_id => '23' # issue form update should_route :post, "/projects/23/issues/new", :controller => 'issues', :action => 'new', :project_id => '23' should_route :post, "/projects/23/issues", :controller => 'issues', :action => 'create', :project_id => '23'