From 83aad1dc04c7284b42afa6dcf92a2c1b06109886 Mon Sep 17 00:00:00 2001 From: Toshi MARUYAMA Date: Sat, 17 Dec 2011 11:55:09 +0000 Subject: [PATCH] test: replace "should_route" of "issue relations" to "assert_routing" at integration/routing_test.rb git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@8257 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- test/integration/routing_test.rb | 75 +++++++++++++++++++++++++------- 1 file changed, 59 insertions(+), 16 deletions(-) diff --git a/test/integration/routing_test.rb b/test/integration/routing_test.rb index 270c9f1bc..0d6638aa1 100644 --- a/test/integration/routing_test.rb +++ b/test/integration/routing_test.rb @@ -392,22 +392,65 @@ class RoutingTest < ActionController::IntegrationTest should_route :delete, "/issue_categories/1.json", :controller => 'issue_categories', :action => 'destroy', :id => '1', :format => 'json' end - context "issue relations" do - should_route :get, "/issues/1/relations", :controller => 'issue_relations', :action => 'index', :issue_id => '1' - should_route :get, "/issues/1/relations.xml", :controller => 'issue_relations', :action => 'index', :issue_id => '1', :format => 'xml' - should_route :get, "/issues/1/relations.json", :controller => 'issue_relations', :action => 'index', :issue_id => '1', :format => 'json' - - should_route :post, "/issues/1/relations", :controller => 'issue_relations', :action => 'create', :issue_id => '1' - should_route :post, "/issues/1/relations.xml", :controller => 'issue_relations', :action => 'create', :issue_id => '1', :format => 'xml' - should_route :post, "/issues/1/relations.json", :controller => 'issue_relations', :action => 'create', :issue_id => '1', :format => 'json' - - should_route :get, "/relations/23", :controller => 'issue_relations', :action => 'show', :id => '23' - should_route :get, "/relations/23.xml", :controller => 'issue_relations', :action => 'show', :id => '23', :format => 'xml' - should_route :get, "/relations/23.json", :controller => 'issue_relations', :action => 'show', :id => '23', :format => 'json' - - should_route :delete, "/relations/23", :controller => 'issue_relations', :action => 'destroy', :id => '23' - should_route :delete, "/relations/23.xml", :controller => 'issue_relations', :action => 'destroy', :id => '23', :format => 'xml' - should_route :delete, "/relations/23.json", :controller => 'issue_relations', :action => 'destroy', :id => '23', :format => 'json' + def test_issue_relations + assert_routing( + { :method => 'get', :path => "/issues/1/relations" }, + { :controller => 'issue_relations', :action => 'index', + :issue_id => '1' } + ) + assert_routing( + { :method => 'get', :path => "/issues/1/relations.xml" }, + { :controller => 'issue_relations', :action => 'index', + :issue_id => '1', :format => 'xml' } + ) + assert_routing( + { :method => 'get', :path => "/issues/1/relations.json" }, + { :controller => 'issue_relations', :action => 'index', + :issue_id => '1', :format => 'json' } + ) + assert_routing( + { :method => 'post', :path => "/issues/1/relations" }, + { :controller => 'issue_relations', :action => 'create', + :issue_id => '1' } + ) + assert_routing( + { :method => 'post', :path => "/issues/1/relations.xml" }, + { :controller => 'issue_relations', :action => 'create', + :issue_id => '1', :format => 'xml' } + ) + assert_routing( + { :method => 'post', :path => "/issues/1/relations.json" }, + { :controller => 'issue_relations', :action => 'create', + :issue_id => '1', :format => 'json' } + ) + assert_routing( + { :method => 'get', :path => "/relations/23" }, + { :controller => 'issue_relations', :action => 'show', :id => '23' } + ) + assert_routing( + { :method => 'get', :path => "/relations/23.xml" }, + { :controller => 'issue_relations', :action => 'show', :id => '23', + :format => 'xml' } + ) + assert_routing( + { :method => 'get', :path => "/relations/23.json" }, + { :controller => 'issue_relations', :action => 'show', :id => '23', + :format => 'json' } + ) + assert_routing( + { :method => 'delete', :path => "/relations/23" }, + { :controller => 'issue_relations', :action => 'destroy', :id => '23' } + ) + assert_routing( + { :method => 'delete', :path => "/relations/23.xml" }, + { :controller => 'issue_relations', :action => 'destroy', :id => '23', + :format => 'xml' } + ) + assert_routing( + { :method => 'delete', :path => "/relations/23.json" }, + { :controller => 'issue_relations', :action => 'destroy', :id => '23', + :format => 'json' } + ) end def test_issue_reports