From 5cfa9e735a61b25ab4b85c75c3eb0f4b789e4b43 2011-12-16 09:56:46 From: Toshi MARUYAMA Date: 2011-12-16 09:56:46 Subject: [PATCH] test: replace "should_route" of "repositories" to "assert_routing" at integration/routing_test.rb git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@8245 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- diff --git a/test/integration/routing_test.rb b/test/integration/routing_test.rb index 2f582f3..3211a07 100644 --- a/test/integration/routing_test.rb +++ b/test/integration/routing_test.rb @@ -487,26 +487,110 @@ class RoutingTest < ActionController::IntegrationTest should_route :delete, "/queries/1", :controller => 'queries', :action => 'destroy', :id => '1' end - context "repositories" do - should_route :get, "/projects/redmine/repository", :controller => 'repositories', :action => 'show', :id => 'redmine' - should_route :get, "/projects/redmine/repository/edit", :controller => 'repositories', :action => 'edit', :id => 'redmine' - should_route :get, "/projects/redmine/repository/revisions", :controller => 'repositories', :action => 'revisions', :id => 'redmine' - should_route :get, "/projects/redmine/repository/revisions.atom", :controller => 'repositories', :action => 'revisions', :id => 'redmine', :format => 'atom' - should_route :get, "/projects/redmine/repository/revisions/2457", :controller => 'repositories', :action => 'revision', :id => 'redmine', :rev => '2457' - should_route :get, "/projects/redmine/repository/revisions/2457/diff", :controller => 'repositories', :action => 'diff', :id => 'redmine', :rev => '2457' - should_route :get, "/projects/redmine/repository/revisions/2457/diff.diff", :controller => 'repositories', :action => 'diff', :id => 'redmine', :rev => '2457', :format => 'diff' - should_route :get, "/projects/redmine/repository/diff/path/to/file.c", :controller => 'repositories', :action => 'diff', :id => 'redmine', :path => %w[path to file.c] - should_route :get, "/projects/redmine/repository/revisions/2/diff/path/to/file.c", :controller => 'repositories', :action => 'diff', :id => 'redmine', :path => %w[path to file.c], :rev => '2' - should_route :get, "/projects/redmine/repository/browse/path/to/file.c", :controller => 'repositories', :action => 'browse', :id => 'redmine', :path => %w[path to file.c] - should_route :get, "/projects/redmine/repository/entry/path/to/file.c", :controller => 'repositories', :action => 'entry', :id => 'redmine', :path => %w[path to file.c] - should_route :get, "/projects/redmine/repository/revisions/2/entry/path/to/file.c", :controller => 'repositories', :action => 'entry', :id => 'redmine', :path => %w[path to file.c], :rev => '2' - should_route :get, "/projects/redmine/repository/raw/path/to/file.c", :controller => 'repositories', :action => 'entry', :id => 'redmine', :path => %w[path to file.c], :format => 'raw' - should_route :get, "/projects/redmine/repository/revisions/2/raw/path/to/file.c", :controller => 'repositories', :action => 'entry', :id => 'redmine', :path => %w[path to file.c], :rev => '2', :format => 'raw' - should_route :get, "/projects/redmine/repository/annotate/path/to/file.c", :controller => 'repositories', :action => 'annotate', :id => 'redmine', :path => %w[path to file.c] - should_route :get, "/projects/redmine/repository/changes/path/to/file.c", :controller => 'repositories', :action => 'changes', :id => 'redmine', :path => %w[path to file.c] - should_route :get, "/projects/redmine/repository/statistics", :controller => 'repositories', :action => 'stats', :id => 'redmine' - - should_route :post, "/projects/redmine/repository/edit", :controller => 'repositories', :action => 'edit', :id => 'redmine' + def test_repositories + assert_routing( + { :method => 'get', + :path => "/projects/redmine/repository" }, + { :controller => 'repositories', :action => 'show', :id => 'redmine' } + ) + assert_routing( + { :method => 'get', + :path => "/projects/redmine/repository/edit" }, + { :controller => 'repositories', :action => 'edit', :id => 'redmine' } + ) + assert_routing( + { :method => 'get', + :path => "/projects/redmine/repository/revisions" }, + { :controller => 'repositories', :action => 'revisions', :id => 'redmine' } + ) + assert_routing( + { :method => 'get', + :path => "/projects/redmine/repository/revisions.atom" }, + { :controller => 'repositories', :action => 'revisions', :id => 'redmine', + :format => 'atom' } + ) + assert_routing( + { :method => 'get', + :path => "/projects/redmine/repository/revisions/2457" }, + { :controller => 'repositories', :action => 'revision', :id => 'redmine', + :rev => '2457' } + ) + assert_routing( + { :method => 'get', + :path => "/projects/redmine/repository/revisions/2457/diff" }, + { :controller => 'repositories', :action => 'diff', :id => 'redmine', + :rev => '2457' } + ) + assert_routing( + { :method => 'get', + :path => "/projects/redmine/repository/revisions/2457/diff.diff" }, + { :controller => 'repositories', :action => 'diff', :id => 'redmine', + :rev => '2457', :format => 'diff' } + ) + assert_routing( + { :method => 'get', + :path => "/projects/redmine/repository/diff/path/to/file.c" }, + { :controller => 'repositories', :action => 'diff', :id => 'redmine', + :path => %w[path to file.c] } + ) + assert_routing( + { :method => 'get', + :path => "/projects/redmine/repository/revisions/2/diff/path/to/file.c" }, + { :controller => 'repositories', :action => 'diff', :id => 'redmine', + :path => %w[path to file.c], :rev => '2' } + ) + assert_routing( + { :method => 'get', + :path => "/projects/redmine/repository/browse/path/to/file.c" }, + { :controller => 'repositories', :action => 'browse', :id => 'redmine', + :path => %w[path to file.c] } + ) + assert_routing( + { :method => 'get', + :path => "/projects/redmine/repository/entry/path/to/file.c" }, + { :controller => 'repositories', :action => 'entry', :id => 'redmine', + :path => %w[path to file.c] } + ) + assert_routing( + { :method => 'get', + :path => "/projects/redmine/repository/revisions/2/entry/path/to/file.c" }, + { :controller => 'repositories', :action => 'entry', :id => 'redmine', + :path => %w[path to file.c], :rev => '2' } + ) + assert_routing( + { :method => 'get', + :path => "/projects/redmine/repository/raw/path/to/file.c" }, + { :controller => 'repositories', :action => 'entry', :id => 'redmine', + :path => %w[path to file.c], :format => 'raw' } + ) + assert_routing( + { :method => 'get', + :path => "/projects/redmine/repository/revisions/2/raw/path/to/file.c" }, + { :controller => 'repositories', :action => 'entry', :id => 'redmine', + :path => %w[path to file.c], :rev => '2', :format => 'raw' } + ) + assert_routing( + { :method => 'get', + :path => "/projects/redmine/repository/annotate/path/to/file.c" }, + { :controller => 'repositories', :action => 'annotate', :id => 'redmine', + :path => %w[path to file.c] } + ) + assert_routing( + { :method => 'get', + :path => "/projects/redmine/repository/changes/path/to/file.c" }, + { :controller => 'repositories', :action => 'changes', :id => 'redmine', + :path => %w[path to file.c] } + ) + assert_routing( + { :method => 'get', + :path => "/projects/redmine/repository/statistics" }, + { :controller => 'repositories', :action => 'stats', :id => 'redmine' } + ) + assert_routing( + { :method => 'post', + :path => "/projects/redmine/repository/edit" }, + { :controller => 'repositories', :action => 'edit', :id => 'redmine' } + ) end context "roles" do