summaryrefslogtreecommitdiffstats
path: root/test/integration
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2014-11-16 14:23:32 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2014-11-16 14:23:32 +0000
commitecda1c7a4f30354db74e73eade71550074f67356 (patch)
tree6f57fba84094ff87a171b05ef3f365bbca69120c /test/integration
parentd72e1f95ba4f5c354fbb701808c20c99266077fd (diff)
downloadredmine-ecda1c7a4f30354db74e73eade71550074f67356.tar.gz
redmine-ecda1c7a4f30354db74e73eade71550074f67356.zip
Use should_route in routing tests.
git-svn-id: http://svn.redmine.org/redmine/trunk@13608 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/integration')
-rw-r--r--test/integration/routing/account_test.rb43
-rw-r--r--test/integration/routing/activities_test.rb29
-rw-r--r--test/integration/routing/admin_test.rb32
-rw-r--r--test/integration/routing/attachments_test.rb42
-rw-r--r--test/integration/routing/auth_sources_test.rb47
-rw-r--r--test/integration/routing/auto_completes_test.rb7
-rw-r--r--test/integration/routing/boards_test.rb48
-rw-r--r--test/integration/routing/calendars_test.rb13
-rw-r--r--test/integration/routing/comments_test.rb13
-rw-r--r--test/integration/routing/context_menus_test.rb18
-rw-r--r--test/integration/routing/custom_fields_test.rb33
-rw-r--r--test/integration/routing/documents_test.rb45
-rw-r--r--test/integration/routing/enumerations_test.rb33
-rw-r--r--test/integration/routing/files_test.rb17
-rw-r--r--test/integration/routing/gantts_test.rb25
-rw-r--r--test/integration/routing/groups_test.rb68
-rw-r--r--test/integration/routing/issue_categories_test.rb39
-rw-r--r--test/integration/routing/issue_relations_test.rb24
-rw-r--r--test/integration/routing/issue_statuses_test.rb41
-rw-r--r--test/integration/routing/issues_test.rb114
-rw-r--r--test/integration/routing/journals_test.rb26
-rw-r--r--test/integration/routing/mail_handler_test.rb7
-rw-r--r--test/integration/routing/members_test.rb34
-rw-r--r--test/integration/routing/messages_test.rb55
-rw-r--r--test/integration/routing/my_test.rb71
-rw-r--r--test/integration/routing/news_test.rb62
-rw-r--r--test/integration/routing/previews_test.rb25
-rw-r--r--test/integration/routing/principal_memberships_test.rb50
-rw-r--r--test/integration/routing/project_enumerations_test.rb14
-rw-r--r--test/integration/routing/projects_test.rb71
-rw-r--r--test/integration/routing/queries_test.rb38
-rw-r--r--test/integration/routing/reports_test.rb13
-rw-r--r--test/integration/routing/repositories_test.rb464
-rw-r--r--test/integration/routing/roles_test.rb42
-rw-r--r--test/integration/routing/search_test.rb12
-rw-r--r--test/integration/routing/settings_test.rb25
-rw-r--r--test/integration/routing/sys_test.rb22
-rw-r--r--test/integration/routing/timelog_test.rb196
-rw-r--r--test/integration/routing/trackers_test.rb46
-rw-r--r--test/integration/routing/users_test.rb43
-rw-r--r--test/integration/routing/versions_test.rb57
-rw-r--r--test/integration/routing/watchers_test.rb38
-rw-r--r--test/integration/routing/welcome_test.rb12
-rw-r--r--test/integration/routing/wiki_test.rb142
-rw-r--r--test/integration/routing/wikis_test.rb18
-rw-r--r--test/integration/routing/workflows_test.rb33
46 files changed, 539 insertions, 1808 deletions
diff --git a/test/integration/routing/account_test.rb b/test/integration/routing/account_test.rb
index c6d331ec0..abd1997ac 100644
--- a/test/integration/routing/account_test.rb
+++ b/test/integration/routing/account_test.rb
@@ -17,35 +17,20 @@
require File.expand_path('../../../test_helper', __FILE__)
-class RoutingAccountTest < ActionDispatch::IntegrationTest
+class RoutingAccountTest < Redmine::RoutingTest
def test_account
- ["get", "post"].each do |method|
- assert_routing(
- { :method => method, :path => "/login" },
- { :controller => 'account', :action => 'login' }
- )
- end
- ["get", "post"].each do |method|
- assert_routing(
- { :method => method, :path => "/logout" },
- { :controller => 'account', :action => 'logout' }
- )
- end
- ["get", "post"].each do |method|
- assert_routing(
- { :method => method, :path => "/account/register" },
- { :controller => 'account', :action => 'register' }
- )
- end
- ["get", "post"].each do |method|
- assert_routing(
- { :method => method, :path => "/account/lost_password" },
- { :controller => 'account', :action => 'lost_password' }
- )
- end
- assert_routing(
- { :method => 'get', :path => "/account/activate" },
- { :controller => 'account', :action => 'activate' }
- )
+ should_route 'GET /login' => 'account#login'
+ should_route 'POST /login' => 'account#login'
+
+ should_route 'GET /logout' => 'account#logout'
+ should_route 'POST /logout' => 'account#logout'
+
+ should_route 'GET /account/register' => 'account#register'
+ should_route 'POST /account/register' => 'account#register'
+
+ should_route 'GET /account/lost_password' => 'account#lost_password'
+ should_route 'POST /account/lost_password' => 'account#lost_password'
+
+ should_route 'GET /account/activate' => 'account#activate'
end
end
diff --git a/test/integration/routing/activities_test.rb b/test/integration/routing/activities_test.rb
index d5b543f40..6212e31a8 100644
--- a/test/integration/routing/activities_test.rb
+++ b/test/integration/routing/activities_test.rb
@@ -17,24 +17,15 @@
require File.expand_path('../../../test_helper', __FILE__)
-class RoutingActivitiesTest < ActionDispatch::IntegrationTest
- def test_activities
- assert_routing(
- { :method => 'get', :path => "/activity" },
- { :controller => 'activities', :action => 'index' }
- )
- assert_routing(
- { :method => 'get', :path => "/activity.atom" },
- { :controller => 'activities', :action => 'index', :format => 'atom' }
- )
- assert_routing(
- { :method => 'get', :path => "/projects/33/activity" },
- { :controller => 'activities', :action => 'index', :id => '33' }
- )
- assert_routing(
- { :method => 'get', :path => "/projects/33/activity.atom" },
- { :controller => 'activities', :action => 'index', :id => '33',
- :format => 'atom' }
- )
+class RoutingActivitiesTest < Redmine::RoutingTest
+
+ def test_activity
+ should_route 'GET /activity' => 'activities#index'
+ should_route 'GET /activity.atom' => 'activities#index', :format => 'atom'
+ end
+
+ def test_project_activity
+ should_route 'GET /projects/33/activity' => 'activities#index', :id => '33'
+ should_route 'GET /projects/33/activity.atom' => 'activities#index', :id => '33', :format => 'atom'
end
end
diff --git a/test/integration/routing/admin_test.rb b/test/integration/routing/admin_test.rb
index 553ebd6b6..2ee5c039a 100644
--- a/test/integration/routing/admin_test.rb
+++ b/test/integration/routing/admin_test.rb
@@ -17,31 +17,13 @@
require File.expand_path('../../../test_helper', __FILE__)
-class RoutingAdminTest < ActionDispatch::IntegrationTest
+class RoutingAdminTest < Redmine::RoutingTest
def test_administration_panel
- assert_routing(
- { :method => 'get', :path => "/admin" },
- { :controller => 'admin', :action => 'index' }
- )
- assert_routing(
- { :method => 'get', :path => "/admin/projects" },
- { :controller => 'admin', :action => 'projects' }
- )
- assert_routing(
- { :method => 'get', :path => "/admin/plugins" },
- { :controller => 'admin', :action => 'plugins' }
- )
- assert_routing(
- { :method => 'get', :path => "/admin/info" },
- { :controller => 'admin', :action => 'info' }
- )
- assert_routing(
- { :method => 'get', :path => "/admin/test_email" },
- { :controller => 'admin', :action => 'test_email' }
- )
- assert_routing(
- { :method => 'post', :path => "/admin/default_configuration" },
- { :controller => 'admin', :action => 'default_configuration' }
- )
+ should_route 'GET /admin' => 'admin#index'
+ should_route 'GET /admin/projects' => 'admin#projects'
+ should_route 'GET /admin/plugins' => 'admin#plugins'
+ should_route 'GET /admin/info' => 'admin#info'
+ should_route 'GET /admin/test_email' => 'admin#test_email'
+ should_route 'POST /admin/default_configuration' => 'admin#default_configuration'
end
end
diff --git a/test/integration/routing/attachments_test.rb b/test/integration/routing/attachments_test.rb
index e01fc5f20..d6d278001 100644
--- a/test/integration/routing/attachments_test.rb
+++ b/test/integration/routing/attachments_test.rb
@@ -17,37 +17,17 @@
require File.expand_path('../../../test_helper', __FILE__)
-class RoutingAttachmentsTest < ActionDispatch::IntegrationTest
+class RoutingAttachmentsTest < Redmine::RoutingTest
def test_attachments
- assert_routing(
- { :method => 'get', :path => "/attachments/1" },
- { :controller => 'attachments', :action => 'show', :id => '1' }
- )
- assert_routing(
- { :method => 'get', :path => "/attachments/1/filename.ext" },
- { :controller => 'attachments', :action => 'show', :id => '1',
- :filename => 'filename.ext' }
- )
- assert_routing(
- { :method => 'get', :path => "/attachments/download/1" },
- { :controller => 'attachments', :action => 'download', :id => '1' }
- )
- assert_routing(
- { :method => 'get', :path => "/attachments/download/1/filename.ext" },
- { :controller => 'attachments', :action => 'download', :id => '1',
- :filename => 'filename.ext' }
- )
- assert_routing(
- { :method => 'get', :path => "/attachments/thumbnail/1" },
- { :controller => 'attachments', :action => 'thumbnail', :id => '1' }
- )
- assert_routing(
- { :method => 'get', :path => "/attachments/thumbnail/1/200" },
- { :controller => 'attachments', :action => 'thumbnail', :id => '1', :size => '200' }
- )
- assert_routing(
- { :method => 'delete', :path => "/attachments/1" },
- { :controller => 'attachments', :action => 'destroy', :id => '1' }
- )
+ should_route 'GET /attachments/1' => 'attachments#show', :id => '1'
+ should_route 'GET /attachments/1/filename.ext' => 'attachments#show', :id => '1', :filename => 'filename.ext'
+
+ should_route 'GET /attachments/download/1' => 'attachments#download', :id => '1'
+ should_route 'GET /attachments/download/1/filename.ext' => 'attachments#download', :id => '1', :filename => 'filename.ext'
+
+ should_route 'GET /attachments/thumbnail/1' => 'attachments#thumbnail', :id => '1'
+ should_route 'GET /attachments/thumbnail/1/200' => 'attachments#thumbnail', :id => '1', :size => '200'
+
+ should_route 'DELETE /attachments/1' => 'attachments#destroy', :id => '1'
end
end
diff --git a/test/integration/routing/auth_sources_test.rb b/test/integration/routing/auth_sources_test.rb
index 1a9605018..17fedff2d 100644
--- a/test/integration/routing/auth_sources_test.rb
+++ b/test/integration/routing/auth_sources_test.rb
@@ -17,43 +17,16 @@
require File.expand_path('../../../test_helper', __FILE__)
-class RoutingAuthSourcesTest < ActionDispatch::IntegrationTest
+class RoutingAuthSourcesTest < Redmine::RoutingTest
def test_auth_sources
- assert_routing(
- { :method => 'get', :path => "/auth_sources" },
- { :controller => 'auth_sources', :action => 'index' }
- )
- assert_routing(
- { :method => 'get', :path => "/auth_sources/new" },
- { :controller => 'auth_sources', :action => 'new' }
- )
- assert_routing(
- { :method => 'post', :path => "/auth_sources" },
- { :controller => 'auth_sources', :action => 'create' }
- )
- assert_routing(
- { :method => 'get', :path => "/auth_sources/1234/edit" },
- { :controller => 'auth_sources', :action => 'edit',
- :id => '1234' }
- )
- assert_routing(
- { :method => 'put', :path => "/auth_sources/1234" },
- { :controller => 'auth_sources', :action => 'update',
- :id => '1234' }
- )
- assert_routing(
- { :method => 'delete', :path => "/auth_sources/1234" },
- { :controller => 'auth_sources', :action => 'destroy',
- :id => '1234' }
- )
- assert_routing(
- { :method => 'get', :path => "/auth_sources/1234/test_connection" },
- { :controller => 'auth_sources', :action => 'test_connection',
- :id => '1234' }
- )
- assert_routing(
- { :method => 'get', :path => "/auth_sources/autocomplete_for_new_user" },
- { :controller => 'auth_sources', :action => 'autocomplete_for_new_user' }
- )
+ should_route 'GET /auth_sources' => 'auth_sources#index'
+ should_route 'GET /auth_sources/new' => 'auth_sources#new'
+ should_route 'POST /auth_sources' => 'auth_sources#create'
+ should_route 'GET /auth_sources/autocomplete_for_new_user' => 'auth_sources#autocomplete_for_new_user'
+
+ should_route 'GET /auth_sources/1234/edit' => 'auth_sources#edit', :id => '1234'
+ should_route 'PUT /auth_sources/1234' => 'auth_sources#update', :id => '1234'
+ should_route 'DELETE /auth_sources/1234' => 'auth_sources#destroy', :id => '1234'
+ should_route 'GET /auth_sources/1234/test_connection' => 'auth_sources#test_connection', :id => '1234'
end
end
diff --git a/test/integration/routing/auto_completes_test.rb b/test/integration/routing/auto_completes_test.rb
index 4b717fc69..923e06980 100644
--- a/test/integration/routing/auto_completes_test.rb
+++ b/test/integration/routing/auto_completes_test.rb
@@ -17,11 +17,8 @@
require File.expand_path('../../../test_helper', __FILE__)
-class RoutingAutoCompletesTest < ActionDispatch::IntegrationTest
+class RoutingAutoCompletesTest < Redmine::RoutingTest
def test_auto_completes
- assert_routing(
- { :method => 'get', :path => "/issues/auto_complete" },
- { :controller => 'auto_completes', :action => 'issues' }
- )
+ should_route 'GET /issues/auto_complete' => 'auto_completes#issues'
end
end
diff --git a/test/integration/routing/boards_test.rb b/test/integration/routing/boards_test.rb
index 6551181c5..2d91fd895 100644
--- a/test/integration/routing/boards_test.rb
+++ b/test/integration/routing/boards_test.rb
@@ -17,44 +17,16 @@
require File.expand_path('../../../test_helper', __FILE__)
-class RoutingBoardsTest < ActionDispatch::IntegrationTest
+class RoutingBoardsTest < Redmine::RoutingTest
def test_boards
- assert_routing(
- { :method => 'get', :path => "/projects/world_domination/boards" },
- { :controller => 'boards', :action => 'index', :project_id => 'world_domination' }
- )
- assert_routing(
- { :method => 'get', :path => "/projects/world_domination/boards/new" },
- { :controller => 'boards', :action => 'new', :project_id => 'world_domination' }
- )
- assert_routing(
- { :method => 'get', :path => "/projects/world_domination/boards/44" },
- { :controller => 'boards', :action => 'show', :project_id => 'world_domination',
- :id => '44' }
- )
- assert_routing(
- { :method => 'get', :path => "/projects/world_domination/boards/44.atom" },
- { :controller => 'boards', :action => 'show', :project_id => 'world_domination',
- :id => '44', :format => 'atom' }
- )
- assert_routing(
- { :method => 'get', :path => "/projects/world_domination/boards/44/edit" },
- { :controller => 'boards', :action => 'edit', :project_id => 'world_domination',
- :id => '44' }
- )
- assert_routing(
- { :method => 'post', :path => "/projects/world_domination/boards" },
- { :controller => 'boards', :action => 'create', :project_id => 'world_domination' }
- )
- assert_routing(
- { :method => 'put', :path => "/projects/world_domination/boards/44" },
- { :controller => 'boards', :action => 'update', :project_id => 'world_domination',
- :id => '44' }
- )
- assert_routing(
- { :method => 'delete', :path => "/projects/world_domination/boards/44" },
- { :controller => 'boards', :action => 'destroy', :project_id => 'world_domination',
- :id => '44' }
- )
+ should_route 'GET /projects/foo/boards' => 'boards#index', :project_id => 'foo'
+ should_route 'GET /projects/foo/boards/new' => 'boards#new', :project_id => 'foo'
+ should_route 'POST /projects/foo/boards' => 'boards#create', :project_id => 'foo'
+
+ should_route 'GET /projects/foo/boards/44' => 'boards#show', :project_id => 'foo', :id => '44'
+ should_route 'GET /projects/foo/boards/44.atom' => 'boards#show', :project_id => 'foo', :id => '44', :format => 'atom'
+ should_route 'GET /projects/foo/boards/44/edit' => 'boards#edit', :project_id => 'foo', :id => '44'
+ should_route 'PUT /projects/foo/boards/44' => 'boards#update', :project_id => 'foo', :id => '44'
+ should_route 'DELETE /projects/foo/boards/44' => 'boards#destroy', :project_id => 'foo', :id => '44'
end
end
diff --git a/test/integration/routing/calendars_test.rb b/test/integration/routing/calendars_test.rb
index 9e8dfd15b..06db1b2ee 100644
--- a/test/integration/routing/calendars_test.rb
+++ b/test/integration/routing/calendars_test.rb
@@ -17,16 +17,9 @@
require File.expand_path('../../../test_helper', __FILE__)
-class RoutingCalendarsTest < ActionDispatch::IntegrationTest
+class RoutingCalendarsTest < Redmine::RoutingTest
def test_calendars
- assert_routing(
- { :method => 'get', :path => "/issues/calendar" },
- { :controller => 'calendars', :action => 'show' }
- )
- assert_routing(
- { :method => 'get', :path => "/projects/project-name/issues/calendar" },
- { :controller => 'calendars', :action => 'show',
- :project_id => 'project-name' }
- )
+ should_route 'GET /issues/calendar' => 'calendars#show'
+ should_route 'GET /projects/foo/issues/calendar' => 'calendars#show', :project_id => 'foo'
end
end
diff --git a/test/integration/routing/comments_test.rb b/test/integration/routing/comments_test.rb
index cd5e259ac..2ead44eaa 100644
--- a/test/integration/routing/comments_test.rb
+++ b/test/integration/routing/comments_test.rb
@@ -17,16 +17,9 @@
require File.expand_path('../../../test_helper', __FILE__)
-class RoutingCommentsTest < ActionDispatch::IntegrationTest
+class RoutingCommentsTest < Redmine::RoutingTest
def test_comments
- assert_routing(
- { :method => 'post', :path => "/news/567/comments" },
- { :controller => 'comments', :action => 'create', :id => '567' }
- )
- assert_routing(
- { :method => 'delete', :path => "/news/567/comments/15" },
- { :controller => 'comments', :action => 'destroy', :id => '567',
- :comment_id => '15' }
- )
+ should_route 'POST /news/567/comments' => 'comments#create', :id => '567'
+ should_route 'DELETE /news/567/comments/15' => 'comments#destroy', :id => '567', :comment_id => '15'
end
end
diff --git a/test/integration/routing/context_menus_test.rb b/test/integration/routing/context_menus_test.rb
index caee1ca25..325393ec0 100644
--- a/test/integration/routing/context_menus_test.rb
+++ b/test/integration/routing/context_menus_test.rb
@@ -17,22 +17,14 @@
require File.expand_path('../../../test_helper', __FILE__)
-class RoutingContextMenusTest < ActionDispatch::IntegrationTest
+class RoutingContextMenusTest < Redmine::RoutingTest
def test_context_menus_time_entries
- ["get", "post"].each do |method|
- assert_routing(
- { :method => method, :path => "/time_entries/context_menu" },
- { :controller => 'context_menus', :action => 'time_entries' }
- )
- end
+ should_route 'GET /time_entries/context_menu' => 'context_menus#time_entries'
+ should_route 'POST /time_entries/context_menu' => 'context_menus#time_entries'
end
def test_context_menus_issues
- ["get", "post"].each do |method|
- assert_routing(
- { :method => method, :path => "/issues/context_menu" },
- { :controller => 'context_menus', :action => 'issues' }
- )
- end
+ should_route 'GET /issues/context_menu' => 'context_menus#issues'
+ should_route 'POST /issues/context_menu' => 'context_menus#issues'
end
end
diff --git a/test/integration/routing/custom_fields_test.rb b/test/integration/routing/custom_fields_test.rb
index 075e28d64..ef9f078f7 100644
--- a/test/integration/routing/custom_fields_test.rb
+++ b/test/integration/routing/custom_fields_test.rb
@@ -17,31 +17,14 @@
require File.expand_path('../../../test_helper', __FILE__)
-class RoutingCustomFieldsTest < ActionDispatch::IntegrationTest
+class RoutingCustomFieldsTest < Redmine::RoutingTest
def test_custom_fields
- assert_routing(
- { :method => 'get', :path => "/custom_fields" },
- { :controller => 'custom_fields', :action => 'index' }
- )
- assert_routing(
- { :method => 'get', :path => "/custom_fields/new" },
- { :controller => 'custom_fields', :action => 'new' }
- )
- assert_routing(
- { :method => 'post', :path => "/custom_fields" },
- { :controller => 'custom_fields', :action => 'create' }
- )
- assert_routing(
- { :method => 'get', :path => "/custom_fields/2/edit" },
- { :controller => 'custom_fields', :action => 'edit', :id => '2' }
- )
- assert_routing(
- { :method => 'put', :path => "/custom_fields/2" },
- { :controller => 'custom_fields', :action => 'update', :id => '2' }
- )
- assert_routing(
- { :method => 'delete', :path => "/custom_fields/2" },
- { :controller => 'custom_fields', :action => 'destroy', :id => '2' }
- )
+ should_route 'GET /custom_fields' => 'custom_fields#index'
+ should_route 'GET /custom_fields/new' => 'custom_fields#new'
+ should_route 'POST /custom_fields' => 'custom_fields#create'
+
+ should_route 'GET /custom_fields/2/edit' => 'custom_fields#edit', :id => '2'
+ should_route 'PUT /custom_fields/2' => 'custom_fields#update', :id => '2'
+ should_route 'DELETE /custom_fields/2' => 'custom_fields#destroy', :id => '2'
end
end
diff --git a/test/integration/routing/documents_test.rb b/test/integration/routing/documents_test.rb
index 5efbeb10e..d9cda08ac 100644
--- a/test/integration/routing/documents_test.rb
+++ b/test/integration/routing/documents_test.rb
@@ -17,42 +17,21 @@
require File.expand_path('../../../test_helper', __FILE__)
-class RoutingDocumentsTest < ActionDispatch::IntegrationTest
+class RoutingDocumentsTest < Redmine::RoutingTest
def test_documents_scoped_under_project
- assert_routing(
- { :method => 'get', :path => "/projects/567/documents" },
- { :controller => 'documents', :action => 'index', :project_id => '567' }
- )
- assert_routing(
- { :method => 'get', :path => "/projects/567/documents/new" },
- { :controller => 'documents', :action => 'new', :project_id => '567' }
- )
- assert_routing(
- { :method => 'post', :path => "/projects/567/documents" },
- { :controller => 'documents', :action => 'create', :project_id => '567' }
- )
+ should_route 'GET /projects/567/documents' => 'documents#index', :project_id => '567'
+ should_route 'GET /projects/567/documents/new' => 'documents#new', :project_id => '567'
+ should_route 'POST /projects/567/documents' => 'documents#create', :project_id => '567'
end
def test_documents
- assert_routing(
- { :method => 'get', :path => "/documents/22" },
- { :controller => 'documents', :action => 'show', :id => '22' }
- )
- assert_routing(
- { :method => 'get', :path => "/documents/22/edit" },
- { :controller => 'documents', :action => 'edit', :id => '22' }
- )
- assert_routing(
- { :method => 'put', :path => "/documents/22" },
- { :controller => 'documents', :action => 'update', :id => '22' }
- )
- assert_routing(
- { :method => 'delete', :path => "/documents/22" },
- { :controller => 'documents', :action => 'destroy', :id => '22' }
- )
- assert_routing(
- { :method => 'post', :path => "/documents/22/add_attachment" },
- { :controller => 'documents', :action => 'add_attachment', :id => '22' }
- )
+ should_route 'GET /documents/22' => 'documents#show', :id => '22'
+ should_route 'GET /documents/22/edit' => 'documents#edit', :id => '22'
+ should_route 'PUT /documents/22' => 'documents#update', :id => '22'
+ should_route 'DELETE /documents/22' => 'documents#destroy', :id => '22'
+ end
+
+ def test_document_attachments
+ should_route 'POST /documents/22/add_attachment' => 'documents#add_attachment', :id => '22'
end
end
diff --git a/test/integration/routing/enumerations_test.rb b/test/integration/routing/enumerations_test.rb
index 8bc88db43..770200d0d 100644
--- a/test/integration/routing/enumerations_test.rb
+++ b/test/integration/routing/enumerations_test.rb
@@ -17,31 +17,14 @@
require File.expand_path('../../../test_helper', __FILE__)
-class RoutingEnumerationsTest < ActionDispatch::IntegrationTest
+class RoutingEnumerationsTest < Redmine::RoutingTest
def test_enumerations
- assert_routing(
- { :method => 'get', :path => "/enumerations" },
- { :controller => 'enumerations', :action => 'index' }
- )
- assert_routing(
- { :method => 'get', :path => "/enumerations/new" },
- { :controller => 'enumerations', :action => 'new' }
- )
- assert_routing(
- { :method => 'post', :path => "/enumerations" },
- { :controller => 'enumerations', :action => 'create' }
- )
- assert_routing(
- { :method => 'get', :path => "/enumerations/2/edit" },
- { :controller => 'enumerations', :action => 'edit', :id => '2' }
- )
- assert_routing(
- { :method => 'put', :path => "/enumerations/2" },
- { :controller => 'enumerations', :action => 'update', :id => '2' }
- )
- assert_routing(
- { :method => 'delete', :path => "/enumerations/2" },
- { :controller => 'enumerations', :action => 'destroy', :id => '2' }
- )
+ should_route 'GET /enumerations' => 'enumerations#index'
+ should_route 'GET /enumerations/new' => 'enumerations#new'
+ should_route 'POST /enumerations' => 'enumerations#create'
+
+ should_route 'GET /enumerations/2/edit' => 'enumerations#edit', :id => '2'
+ should_route 'PUT /enumerations/2' => 'enumerations#update', :id => '2'
+ should_route 'DELETE /enumerations/2' => 'enumerations#destroy', :id => '2'
end
end
diff --git a/test/integration/routing/files_test.rb b/test/integration/routing/files_test.rb
index ea6a5aae0..f11e2ff17 100644
--- a/test/integration/routing/files_test.rb
+++ b/test/integration/routing/files_test.rb
@@ -17,19 +17,10 @@
require File.expand_path('../../../test_helper', __FILE__)
-class RoutingFilesTest < ActionDispatch::IntegrationTest
+class RoutingFilesTest < Redmine::RoutingTest
def test_files
- assert_routing(
- { :method => 'get', :path => "/projects/33/files" },
- { :controller => 'files', :action => 'index', :project_id => '33' }
- )
- assert_routing(
- { :method => 'get', :path => "/projects/33/files/new" },
- { :controller => 'files', :action => 'new', :project_id => '33' }
- )
- assert_routing(
- { :method => 'post', :path => "/projects/33/files" },
- { :controller => 'files', :action => 'create', :project_id => '33' }
- )
+ should_route 'GET /projects/foo/files' => 'files#index', :project_id => 'foo'
+ should_route 'GET /projects/foo/files/new' => 'files#new', :project_id => 'foo'
+ should_route 'POST /projects/foo/files' => 'files#create', :project_id => 'foo'
end
end
diff --git a/test/integration/routing/gantts_test.rb b/test/integration/routing/gantts_test.rb
index c2c626c0e..add7e0774 100644
--- a/test/integration/routing/gantts_test.rb
+++ b/test/integration/routing/gantts_test.rb
@@ -17,25 +17,12 @@
require File.expand_path('../../../test_helper', __FILE__)
-class RoutingGanttsTest < ActionDispatch::IntegrationTest
+class RoutingGanttsTest < Redmine::RoutingTest
def test_gantts
- assert_routing(
- { :method => 'get', :path => "/issues/gantt" },
- { :controller => 'gantts', :action => 'show' }
- )
- assert_routing(
- { :method => 'get', :path => "/issues/gantt.pdf" },
- { :controller => 'gantts', :action => 'show', :format => 'pdf' }
- )
- assert_routing(
- { :method => 'get', :path => "/projects/project-name/issues/gantt" },
- { :controller => 'gantts', :action => 'show',
- :project_id => 'project-name' }
- )
- assert_routing(
- { :method => 'get', :path => "/projects/project-name/issues/gantt.pdf" },
- { :controller => 'gantts', :action => 'show',
- :project_id => 'project-name', :format => 'pdf' }
- )
+ should_route 'GET /issues/gantt' => 'gantts#show'
+ should_route 'GET /issues/gantt.pdf' => 'gantts#show', :format => 'pdf'
+
+ should_route 'GET /projects/foo/issues/gantt' => 'gantts#show', :project_id => 'foo'
+ should_route 'GET /projects/foo/issues/gantt.pdf' => 'gantts#show', :project_id => 'foo', :format => 'pdf'
end
end
diff --git a/test/integration/routing/groups_test.rb b/test/integration/routing/groups_test.rb
index 243046c74..a9f54016a 100644
--- a/test/integration/routing/groups_test.rb
+++ b/test/integration/routing/groups_test.rb
@@ -17,58 +17,24 @@
require File.expand_path('../../../test_helper', __FILE__)
-class RoutingGroupsTest < ActionDispatch::IntegrationTest
- def test_groups_resources
- assert_routing(
- { :method => 'get', :path => "/groups" },
- { :controller => 'groups', :action => 'index' }
- )
- assert_routing(
- { :method => 'post', :path => "/groups" },
- { :controller => 'groups', :action => 'create' }
- )
- assert_routing(
- { :method => 'get', :path => "/groups/new" },
- { :controller => 'groups', :action => 'new' }
- )
- assert_routing(
- { :method => 'get', :path => "/groups/1/edit" },
- { :controller => 'groups', :action => 'edit', :id => '1' }
- )
- assert_routing(
- { :method => 'get', :path => "/groups/1/autocomplete_for_user" },
- { :controller => 'groups', :action => 'autocomplete_for_user', :id => '1' }
- )
- assert_routing(
- { :method => 'get', :path => "/groups/1/autocomplete_for_user.js" },
- { :controller => 'groups', :action => 'autocomplete_for_user', :id => '1', :format => 'js' }
- )
- assert_routing(
- { :method => 'get', :path => "/groups/1" },
- { :controller => 'groups', :action => 'show', :id => '1' }
- )
- assert_routing(
- { :method => 'put', :path => "/groups/1" },
- { :controller => 'groups', :action => 'update', :id => '1' }
- )
- assert_routing(
- { :method => 'delete', :path => "/groups/1" },
- { :controller => 'groups', :action => 'destroy', :id => '1' }
- )
+class RoutingGroupsTest < Redmine::RoutingTest
+ def test_groups
+ should_route 'GET /groups' => 'groups#index'
+ should_route 'GET /groups/new' => 'groups#new'
+ should_route 'POST /groups' => 'groups#create'
+
+ should_route 'GET /groups/1' => 'groups#show', :id => '1'
+ should_route 'GET /groups/1/edit' => 'groups#edit', :id => '1'
+ should_route 'PUT /groups/1' => 'groups#update', :id => '1'
+ should_route 'DELETE /groups/1' => 'groups#destroy', :id => '1'
+
+ should_route 'GET /groups/1/autocomplete_for_user' => 'groups#autocomplete_for_user', :id => '1'
+ should_route 'GET /groups/1/autocomplete_for_user.js' => 'groups#autocomplete_for_user', :id => '1', :format => 'js'
end
- def test_groups
- assert_routing(
- { :method => 'get', :path => "/groups/567/users/new" },
- { :controller => 'groups', :action => 'new_users', :id => '567' }
- )
- assert_routing(
- { :method => 'post', :path => "/groups/567/users" },
- { :controller => 'groups', :action => 'add_users', :id => '567' }
- )
- assert_routing(
- { :method => 'delete', :path => "/groups/567/users/12" },
- { :controller => 'groups', :action => 'remove_user', :id => '567', :user_id => '12' }
- )
+ def test_group_users
+ should_route 'GET /groups/567/users/new' => 'groups#new_users', :id => '567'
+ should_route 'POST /groups/567/users' => 'groups#add_users', :id => '567'
+ should_route 'DELETE /groups/567/users/12' => 'groups#remove_user', :id => '567', :user_id => '12'
end
end
diff --git a/test/integration/routing/issue_categories_test.rb b/test/integration/routing/issue_categories_test.rb
index fe1d732ce..a6be0ae40 100644
--- a/test/integration/routing/issue_categories_test.rb
+++ b/test/integration/routing/issue_categories_test.rb
@@ -17,41 +17,16 @@
require File.expand_path('../../../test_helper', __FILE__)
-class RoutingIssueCategoriesTest < ActionDispatch::IntegrationTest
+class RoutingIssueCategoriesTest < Redmine::RoutingTest
def test_issue_categories_scoped_under_project
- assert_routing(
- { :method => 'get', :path => "/projects/foo/issue_categories" },
- { :controller => 'issue_categories', :action => 'index',
- :project_id => 'foo' }
- )
- assert_routing(
- { :method => 'get', :path => "/projects/foo/issue_categories/new" },
- { :controller => 'issue_categories', :action => 'new',
- :project_id => 'foo' }
- )
- assert_routing(
- { :method => 'post', :path => "/projects/foo/issue_categories" },
- { :controller => 'issue_categories', :action => 'create',
- :project_id => 'foo' }
- )
+ should_route 'GET /projects/foo/issue_categories' => 'issue_categories#index', :project_id => 'foo'
+ should_route 'GET /projects/foo/issue_categories/new' => 'issue_categories#new', :project_id => 'foo'
+ should_route 'POST /projects/foo/issue_categories' => 'issue_categories#create', :project_id => 'foo'
end
def test_issue_categories
- assert_routing(
- { :method => 'get', :path => "/issue_categories/1" },
- { :controller => 'issue_categories', :action => 'show', :id => '1' }
- )
- assert_routing(
- { :method => 'get', :path => "/issue_categories/1/edit" },
- { :controller => 'issue_categories', :action => 'edit', :id => '1' }
- )
- assert_routing(
- { :method => 'put', :path => "/issue_categories/1" },
- { :controller => 'issue_categories', :action => 'update', :id => '1' }
- )
- assert_routing(
- { :method => 'delete', :path => "/issue_categories/1" },
- { :controller => 'issue_categories', :action => 'destroy', :id => '1' }
- )
+ should_route 'GET /issue_categories/1/edit' => 'issue_categories#edit', :id => '1'
+ should_route 'PUT /issue_categories/1' => 'issue_categories#update', :id => '1'
+ should_route 'DELETE /issue_categories/1' => 'issue_categories#destroy', :id => '1'
end
end
diff --git a/test/integration/routing/issue_relations_test.rb b/test/integration/routing/issue_relations_test.rb
index 502dfbd79..a1a6bd64b 100644
--- a/test/integration/routing/issue_relations_test.rb
+++ b/test/integration/routing/issue_relations_test.rb
@@ -17,25 +17,11 @@
require File.expand_path('../../../test_helper', __FILE__)
-class RoutingIssueRelationsTest < ActionDispatch::IntegrationTest
+class RoutingIssueRelationsTest < Redmine::RoutingTest
def test_issue_relations
- assert_routing(
- { :method => 'get', :path => "/issues/1/relations" },
- { :controller => 'issue_relations', :action => 'index',
- :issue_id => '1' }
- )
- assert_routing(
- { :method => 'post', :path => "/issues/1/relations" },
- { :controller => 'issue_relations', :action => 'create',
- :issue_id => '1' }
- )
- assert_routing(
- { :method => 'get', :path => "/relations/23" },
- { :controller => 'issue_relations', :action => 'show', :id => '23' }
- )
- assert_routing(
- { :method => 'delete', :path => "/relations/23" },
- { :controller => 'issue_relations', :action => 'destroy', :id => '23' }
- )
+ should_route 'GET /issues/1/relations' => 'issue_relations#index', :issue_id => '1'
+ should_route 'POST /issues/1/relations' => 'issue_relations#create', :issue_id => '1'
+
+ should_route 'DELETE /relations/23' => 'issue_relations#destroy', :id => '23'
end
end
diff --git a/test/integration/routing/issue_statuses_test.rb b/test/integration/routing/issue_statuses_test.rb
index 8a1171332..5db6dfa1a 100644
--- a/test/integration/routing/issue_statuses_test.rb
+++ b/test/integration/routing/issue_statuses_test.rb
@@ -17,37 +17,16 @@
require File.expand_path('../../../test_helper', __FILE__)
-class RoutingIssueStatusesTest < ActionDispatch::IntegrationTest
+class RoutingIssueStatusesTest < Redmine::RoutingTest
def test_issue_statuses
- assert_routing(
- { :method => 'get', :path => "/issue_statuses" },
- { :controller => 'issue_statuses', :action => 'index' }
- )
- assert_routing(
- { :method => 'post', :path => "/issue_statuses" },
- { :controller => 'issue_statuses', :action => 'create' }
- )
- assert_routing(
- { :method => 'get', :path => "/issue_statuses/new" },
- { :controller => 'issue_statuses', :action => 'new' }
- )
- assert_routing(
- { :method => 'get', :path => "/issue_statuses/1/edit" },
- { :controller => 'issue_statuses', :action => 'edit', :id => '1' }
- )
- assert_routing(
- { :method => 'put', :path => "/issue_statuses/1" },
- { :controller => 'issue_statuses', :action => 'update',
- :id => '1' }
- )
- assert_routing(
- { :method => 'delete', :path => "/issue_statuses/1" },
- { :controller => 'issue_statuses', :action => 'destroy',
- :id => '1' }
- )
- assert_routing(
- { :method => 'post', :path => "/issue_statuses/update_issue_done_ratio" },
- { :controller => 'issue_statuses', :action => 'update_issue_done_ratio' }
- )
+ should_route 'GET /issue_statuses' => 'issue_statuses#index'
+ should_route 'POST /issue_statuses' => 'issue_statuses#create'
+ should_route 'GET /issue_statuses/new' => 'issue_statuses#new'
+
+ should_route 'GET /issue_statuses/1/edit' => 'issue_statuses#edit', :id => '1'
+ should_route 'PUT /issue_statuses/1' => 'issue_statuses#update', :id => '1'
+ should_route 'DELETE /issue_statuses/1' => 'issue_statuses#destroy', :id => '1'
+
+ should_route 'POST /issue_statuses/update_issue_done_ratio' => 'issue_statuses#update_issue_done_ratio'
end
end
diff --git a/test/integration/routing/issues_test.rb b/test/integration/routing/issues_test.rb
index 6b1c83c6d..f0e9a5219 100644
--- a/test/integration/routing/issues_test.rb
+++ b/test/integration/routing/issues_test.rb
@@ -17,98 +17,40 @@
require File.expand_path('../../../test_helper', __FILE__)
-class RoutingIssuesTest < ActionDispatch::IntegrationTest
+class RoutingIssuesTest < Redmine::RoutingTest
def test_issues
- 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/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/edit" },
- { :controller => 'issues', :action => 'edit', :id => '64' }
- )
- assert_routing(
- { :method => 'put', :path => "/issues/1" },
- { :controller => 'issues', :action => 'update', :id => '1' }
- )
- assert_routing(
- { :method => 'delete', :path => "/issues/1" },
- { :controller => 'issues', :action => 'destroy', :id => '1' }
- )
+ should_route 'GET /issues' => 'issues#index'
+ should_route 'GET /issues.pdf' => 'issues#index', :format => 'pdf'
+ should_route 'GET /issues.atom' => 'issues#index', :format => 'atom'
+
+ should_route 'GET /issues/64' => 'issues#show', :id => '64'
+ should_route 'GET /issues/64.pdf' => 'issues#show', :id => '64', :format => 'pdf'
+ should_route 'GET /issues/64.atom' => 'issues#show', :id => '64', :format => 'atom'
+
+ should_route 'GET /issues/64/edit' => 'issues#edit', :id => '64'
+ should_route 'PUT /issues/64' => 'issues#update', :id => '64'
+ should_route 'DELETE /issues/64' => 'issues#destroy', :id => '64'
end
- def test_issues_scoped_under_project
- 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 => 'post', :path => "/projects/23/issues" },
- { :controller => 'issues', :action => 'create', :project_id => '23' }
- )
- assert_routing(
- { :method => 'get', :path => "/projects/23/issues/new" },
- { :controller => 'issues', :action => 'new', :project_id => '23' }
- )
+ def test_issues_bulk_edit
+ should_route 'GET /issues/bulk_edit' => 'issues#bulk_edit'
+ should_route 'POST /issues/bulk_edit' => 'issues#bulk_edit' # For updating the bulk edit form
+ should_route 'POST /issues/bulk_update' => 'issues#bulk_update'
end
- def test_issues_form_update
- ["post", "put"].each do |method|
- assert_routing(
- { :method => method, :path => "/projects/23/issues/update_form" },
- { :controller => 'issues', :action => 'update_form', :project_id => '23' }
- )
- end
+ def test_issues_scoped_under_project
+ should_route 'GET /projects/23/issues' => 'issues#index', :project_id => '23'
+ should_route 'GET /projects/23/issues.pdf' => 'issues#index', :project_id => '23', :format => 'pdf'
+ should_route 'GET /projects/23/issues.atom' => 'issues#index', :project_id => '23', :format => 'atom'
+
+ should_route 'GET /projects/23/issues/new' => 'issues#new', :project_id => '23'
+ should_route 'POST /projects/23/issues' => 'issues#create', :project_id => '23'
+
+ should_route 'GET /projects/23/issues/64/copy' => 'issues#new', :project_id => '23', :copy_from => '64'
end
- def test_issues_extra_actions
- assert_routing(
- { :method => 'get', :path => "/projects/23/issues/64/copy" },
- { :controller => 'issues', :action => 'new', :project_id => '23',
- :copy_from => '64' }
- )
- # For updating the bulk edit form
- ["get", "post"].each do |method|
- assert_routing(
- { :method => method, :path => "/issues/bulk_edit" },
- { :controller => 'issues', :action => 'bulk_edit' }
- )
- end
- assert_routing(
- { :method => 'post', :path => "/issues/bulk_update" },
- { :controller => 'issues', :action => 'bulk_update' }
- )
+ def test_issues_form_update
+ should_route 'POST /projects/23/issues/update_form' => 'issues#update_form', :project_id => '23'
+ should_route 'PUT /projects/23/issues/update_form' => 'issues#update_form', :project_id => '23'
end
end
diff --git a/test/integration/routing/journals_test.rb b/test/integration/routing/journals_test.rb
index 390e77425..d696a5575 100644
--- a/test/integration/routing/journals_test.rb
+++ b/test/integration/routing/journals_test.rb
@@ -17,25 +17,13 @@
require File.expand_path('../../../test_helper', __FILE__)
-class RoutingJournalsTest < ActionDispatch::IntegrationTest
+class RoutingJournalsTest < Redmine::RoutingTest
def test_journals
- assert_routing(
- { :method => 'post', :path => "/issues/1/quoted" },
- { :controller => 'journals', :action => 'new', :id => '1' }
- )
- assert_routing(
- { :method => 'get', :path => "/issues/changes" },
- { :controller => 'journals', :action => 'index' }
- )
- assert_routing(
- { :method => 'get', :path => "/journals/diff/1" },
- { :controller => 'journals', :action => 'diff', :id => '1' }
- )
- ["get", "post"].each do |method|
- assert_routing(
- { :method => method, :path => "/journals/edit/1" },
- { :controller => 'journals', :action => 'edit', :id => '1' }
- )
- end
+ should_route 'POST /issues/1/quoted' => 'journals#new', :id => '1'
+ should_route 'GET /issues/changes' => 'journals#index'
+ should_route 'GET /journals/diff/1' => 'journals#diff', :id => '1'
+
+ should_route 'GET /journals/edit/1' => 'journals#edit', :id => '1'
+ should_route 'POST /journals/edit/1' => 'journals#edit', :id => '1'
end
end
diff --git a/test/integration/routing/mail_handler_test.rb b/test/integration/routing/mail_handler_test.rb
index 8abb5369a..f130990c2 100644
--- a/test/integration/routing/mail_handler_test.rb
+++ b/test/integration/routing/mail_handler_test.rb
@@ -17,11 +17,8 @@
require File.expand_path('../../../test_helper', __FILE__)
-class RoutingMailHandlerTest < ActionDispatch::IntegrationTest
+class RoutingMailHandlerTest < Redmine::RoutingTest
def test_mail_handler
- assert_routing(
- { :method => "post", :path => "/mail_handler" },
- { :controller => 'mail_handler', :action => 'index' }
- )
+ should_route 'POST /mail_handler' => 'mail_handler#index'
end
end
diff --git a/test/integration/routing/members_test.rb b/test/integration/routing/members_test.rb
index cb70bd632..f87479013 100644
--- a/test/integration/routing/members_test.rb
+++ b/test/integration/routing/members_test.rb
@@ -17,31 +17,15 @@
require File.expand_path('../../../test_helper', __FILE__)
-class RoutingMembersTest < ActionDispatch::IntegrationTest
+class RoutingMembersTest < Redmine::RoutingTest
def test_members
- assert_routing(
- { :method => 'post', :path => "/projects/5234/memberships" },
- { :controller => 'members', :action => 'create', :project_id => '5234' }
- )
- assert_routing(
- { :method => 'get', :path => "/projects/5234/memberships/new" },
- { :controller => 'members', :action => 'new', :project_id => '5234' }
- )
- assert_routing(
- { :method => 'put', :path => "/memberships/5234" },
- { :controller => 'members', :action => 'update', :id => '5234' }
- )
- assert_routing(
- { :method => 'delete', :path => "/memberships/5234" },
- { :controller => 'members', :action => 'destroy', :id => '5234' }
- )
- assert_routing(
- { :method => 'get', :path => "/projects/5234/memberships/autocomplete" },
- { :controller => 'members', :action => 'autocomplete', :project_id => '5234' }
- )
- assert_routing(
- { :method => 'get', :path => "/projects/5234/memberships/autocomplete.js" },
- { :controller => 'members', :action => 'autocomplete', :project_id => '5234', :format => 'js' }
- )
+ should_route 'GET /projects/foo/memberships/new' => 'members#new', :project_id => 'foo'
+ should_route 'POST /projects/foo/memberships' => 'members#create', :project_id => 'foo'
+
+ should_route 'PUT /memberships/5234' => 'members#update', :id => '5234'
+ should_route 'DELETE /memberships/5234' => 'members#destroy', :id => '5234'
+
+ should_route 'GET /projects/foo/memberships/autocomplete' => 'members#autocomplete', :project_id => 'foo'
+ should_route 'GET /projects/foo/memberships/autocomplete.js' => 'members#autocomplete', :project_id => 'foo', :format => 'js'
end
end
diff --git a/test/integration/routing/messages_test.rb b/test/integration/routing/messages_test.rb
index 696bc86a6..9dc63fdce 100644
--- a/test/integration/routing/messages_test.rb
+++ b/test/integration/routing/messages_test.rb
@@ -17,50 +17,17 @@
require File.expand_path('../../../test_helper', __FILE__)
-class RoutingMessagesTest < ActionDispatch::IntegrationTest
+class RoutingMessagesTest < Redmine::RoutingTest
def test_messages
- assert_routing(
- { :method => 'get', :path => "/boards/22/topics/2" },
- { :controller => 'messages', :action => 'show', :id => '2',
- :board_id => '22' }
- )
- assert_routing(
- { :method => 'get', :path => "/boards/lala/topics/new" },
- { :controller => 'messages', :action => 'new', :board_id => 'lala' }
- )
- assert_routing(
- { :method => 'get', :path => "/boards/lala/topics/22/edit" },
- { :controller => 'messages', :action => 'edit', :id => '22',
- :board_id => 'lala' }
- )
- assert_routing(
- { :method => 'post', :path => "/boards/lala/topics/quote/22" },
- { :controller => 'messages', :action => 'quote', :id => '22',
- :board_id => 'lala' }
- )
- assert_routing(
- { :method => 'post', :path => "/boards/lala/topics/new" },
- { :controller => 'messages', :action => 'new', :board_id => 'lala' }
- )
- assert_routing(
- { :method => 'post', :path => "/boards/lala/topics/preview" },
- { :controller => 'messages', :action => 'preview',
- :board_id => 'lala' }
- )
- assert_routing(
- { :method => 'post', :path => "/boards/lala/topics/22/edit" },
- { :controller => 'messages', :action => 'edit', :id => '22',
- :board_id => 'lala' }
- )
- assert_routing(
- { :method => 'post', :path => "/boards/22/topics/555/replies" },
- { :controller => 'messages', :action => 'reply', :id => '555',
- :board_id => '22' }
- )
- assert_routing(
- { :method => 'post', :path => "/boards/22/topics/555/destroy" },
- { :controller => 'messages', :action => 'destroy', :id => '555',
- :board_id => '22' }
- )
+ # TODO: refactor routes
+ should_route 'GET /boards/22/topics/new' => 'messages#new', :board_id => '22'
+ should_route 'POST /boards/22/topics/new' => 'messages#new', :board_id => '22'
+ should_route 'POST /boards/22/topics/preview' => 'messages#preview', :board_id => '22'
+
+ should_route 'GET /boards/22/topics/2' => 'messages#show', :id => '2', :board_id => '22'
+ should_route 'GET /boards/22/topics/2/edit' => 'messages#edit', :id => '2', :board_id => '22'
+ should_route 'POST /boards/22/topics/quote/2' => 'messages#quote', :id => '2', :board_id => '22'
+ should_route 'POST /boards/22/topics/2/replies' => 'messages#reply', :id => '2', :board_id => '22'
+ should_route 'POST /boards/22/topics/2/destroy' => 'messages#destroy', :id => '2', :board_id => '22'
end
end
diff --git a/test/integration/routing/my_test.rb b/test/integration/routing/my_test.rb
index 0f5f3e24b..e9089d19a 100644
--- a/test/integration/routing/my_test.rb
+++ b/test/integration/routing/my_test.rb
@@ -17,57 +17,26 @@
require File.expand_path('../../../test_helper', __FILE__)
-class RoutingMyTest < ActionDispatch::IntegrationTest
+class RoutingMyTest < Redmine::RoutingTest
def test_my
- ["get", "post"].each do |method|
- assert_routing(
- { :method => method, :path => "/my/account" },
- { :controller => 'my', :action => 'account' }
- )
- end
- ["get", "post"].each do |method|
- assert_routing(
- { :method => method, :path => "/my/account/destroy" },
- { :controller => 'my', :action => 'destroy' }
- )
- end
- assert_routing(
- { :method => 'get', :path => "/my/page" },
- { :controller => 'my', :action => 'page' }
- )
- assert_routing(
- { :method => 'get', :path => "/my" },
- { :controller => 'my', :action => 'index' }
- )
- assert_routing(
- { :method => 'post', :path => "/my/reset_rss_key" },
- { :controller => 'my', :action => 'reset_rss_key' }
- )
- assert_routing(
- { :method => 'post', :path => "/my/reset_api_key" },
- { :controller => 'my', :action => 'reset_api_key' }
- )
- ["get", "post"].each do |method|
- assert_routing(
- { :method => method, :path => "/my/password" },
- { :controller => 'my', :action => 'password' }
- )
- end
- assert_routing(
- { :method => 'get', :path => "/my/page_layout" },
- { :controller => 'my', :action => 'page_layout' }
- )
- assert_routing(
- { :method => 'post', :path => "/my/add_block" },
- { :controller => 'my', :action => 'add_block' }
- )
- assert_routing(
- { :method => 'post', :path => "/my/remove_block" },
- { :controller => 'my', :action => 'remove_block' }
- )
- assert_routing(
- { :method => 'post', :path => "/my/order_blocks" },
- { :controller => 'my', :action => 'order_blocks' }
- )
+ should_route 'GET /my/account' => 'my#account'
+ should_route 'POST /my/account' => 'my#account'
+
+ should_route 'GET /my/account/destroy' => 'my#destroy'
+ should_route 'POST /my/account/destroy' => 'my#destroy'
+
+ should_route 'GET /my/page' => 'my#page'
+ should_route 'GET /my' => 'my#index'
+
+ should_route 'POST /my/reset_rss_key' => 'my#reset_rss_key'
+ should_route 'POST /my/reset_api_key' => 'my#reset_api_key'
+
+ should_route 'GET /my/password' => 'my#password'
+ should_route 'POST /my/password' => 'my#password'
+
+ should_route 'GET /my/page_layout' => 'my#page_layout'
+ should_route 'POST /my/add_block' => 'my#add_block'
+ should_route 'POST /my/remove_block' => 'my#remove_block'
+ should_route 'POST /my/order_blocks' => 'my#order_blocks'
end
end
diff --git a/test/integration/routing/news_test.rb b/test/integration/routing/news_test.rb
index c7ca04016..fff59d3c8 100644
--- a/test/integration/routing/news_test.rb
+++ b/test/integration/routing/news_test.rb
@@ -17,58 +17,20 @@
require File.expand_path('../../../test_helper', __FILE__)
-class RoutingNewsTest < ActionDispatch::IntegrationTest
- def test_news_index
- assert_routing(
- { :method => 'get', :path => "/news" },
- { :controller => 'news', :action => 'index' }
- )
- assert_routing(
- { :method => 'get', :path => "/news.atom" },
- { :controller => 'news', :action => 'index', :format => 'atom' }
- )
+class RoutingNewsTest < Redmine::RoutingTest
+ def test_news_scoped_under_project
+ should_route 'GET /projects/foo/news' => 'news#index', :project_id => 'foo'
+ should_route 'GET /projects/foo/news.atom' => 'news#index', :project_id => 'foo', :format => 'atom'
+ should_route 'GET /projects/foo/news/new' => 'news#new', :project_id => 'foo'
+ should_route 'POST /projects/foo/news' => 'news#create', :project_id => 'foo'
end
def test_news
- assert_routing(
- { :method => 'get', :path => "/news/2" },
- { :controller => 'news', :action => 'show', :id => '2' }
- )
- 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 => 'put', :path => "/news/567" },
- { :controller => 'news', :action => 'update', :id => '567' }
- )
- assert_routing(
- { :method => 'delete', :path => "/news/567" },
- { :controller => 'news', :action => 'destroy', :id => '567' }
- )
- end
-
- def test_news_scoped_under_project
- assert_routing(
- { :method => 'get', :path => "/projects/567/news" },
- { :controller => 'news', :action => 'index', :project_id => '567' }
- )
- 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/new" },
- { :controller => 'news', :action => 'new', :project_id => '567' }
- )
- assert_routing(
- { :method => 'post', :path => "/projects/567/news" },
- { :controller => 'news', :action => 'create', :project_id => '567' }
- )
+ should_route 'GET /news' => 'news#index'
+ should_route 'GET /news.atom' => 'news#index', :format => 'atom'
+ should_route 'GET /news/2' => 'news#show', :id => '2'
+ should_route 'GET /news/2/edit' => 'news#edit', :id => '2'
+ should_route 'PUT /news/2' => 'news#update', :id => '2'
+ should_route 'DELETE /news/2' => 'news#destroy', :id => '2'
end
end
diff --git a/test/integration/routing/previews_test.rb b/test/integration/routing/previews_test.rb
index fcdcfe5bd..91315fe2d 100644
--- a/test/integration/routing/previews_test.rb
+++ b/test/integration/routing/previews_test.rb
@@ -17,21 +17,16 @@
require File.expand_path('../../../test_helper', __FILE__)
-class RoutingPreviewsTest < ActionDispatch::IntegrationTest
+class RoutingPreviewsTest < Redmine::RoutingTest
def test_previews
- ["get", "post", "put"].each do |method|
- assert_routing(
- { :method => method, :path => "/issues/preview/new/123" },
- { :controller => 'previews', :action => 'issue', :project_id => '123' }
- )
- assert_routing(
- { :method => method, :path => "/issues/preview/edit/321" },
- { :controller => 'previews', :action => 'issue', :id => '321' }
- )
- end
- assert_routing(
- { :method => 'get', :path => "/news/preview" },
- { :controller => 'previews', :action => 'news' }
- )
+ should_route 'GET /issues/preview/new/foo' => 'previews#issue', :project_id => 'foo'
+ should_route 'PUT /issues/preview/new/foo' => 'previews#issue', :project_id => 'foo'
+ should_route 'POST /issues/preview/new/foo' => 'previews#issue', :project_id => 'foo'
+
+ should_route 'GET /issues/preview/edit/321' => 'previews#issue', :id => '321'
+ should_route 'PUT /issues/preview/edit/321' => 'previews#issue', :id => '321'
+ should_route 'POST /issues/preview/edit/321' => 'previews#issue', :id => '321'
+
+ should_route 'GET /news/preview' => 'previews#news'
end
end
diff --git a/test/integration/routing/principal_memberships_test.rb b/test/integration/routing/principal_memberships_test.rb
index 4aeed1331..2cb3407e9 100644
--- a/test/integration/routing/principal_memberships_test.rb
+++ b/test/integration/routing/principal_memberships_test.rb
@@ -17,50 +17,18 @@
require File.expand_path('../../../test_helper', __FILE__)
-class RoutingPrincipalMembershipsTest < ActionDispatch::IntegrationTest
+class RoutingPrincipalMembershipsTest < Redmine::RoutingTest
def test_user_memberships
- assert_routing(
- { :method => 'get', :path => "/users/123/memberships/new" },
- { :controller => 'principal_memberships', :action => 'new',
- :user_id => '123' }
- )
- assert_routing(
- { :method => 'post', :path => "/users/123/memberships" },
- { :controller => 'principal_memberships', :action => 'create',
- :user_id => '123' }
- )
- assert_routing(
- { :method => 'put', :path => "/users/123/memberships/55" },
- { :controller => 'principal_memberships', :action => 'update',
- :user_id => '123', :id => '55' }
- )
- assert_routing(
- { :method => 'delete', :path => "/users/123/memberships/55" },
- { :controller => 'principal_memberships', :action => 'destroy',
- :user_id => '123', :id => '55' }
- )
+ should_route 'GET /users/123/memberships/new' => 'principal_memberships#new', :user_id => '123'
+ should_route 'POST /users/123/memberships' => 'principal_memberships#create', :user_id => '123'
+ should_route 'PUT /users/123/memberships/55' => 'principal_memberships#update', :user_id => '123', :id => '55'
+ should_route 'DELETE /users/123/memberships/55' => 'principal_memberships#destroy', :user_id => '123', :id => '55'
end
def test_group_memberships
- assert_routing(
- { :method => 'get', :path => "/groups/123/memberships/new" },
- { :controller => 'principal_memberships', :action => 'new',
- :group_id => '123' }
- )
- assert_routing(
- { :method => 'post', :path => "/groups/123/memberships" },
- { :controller => 'principal_memberships', :action => 'create',
- :group_id => '123' }
- )
- assert_routing(
- { :method => 'put', :path => "/groups/123/memberships/55" },
- { :controller => 'principal_memberships', :action => 'update',
- :group_id => '123', :id => '55' }
- )
- assert_routing(
- { :method => 'delete', :path => "/groups/123/memberships/55" },
- { :controller => 'principal_memberships', :action => 'destroy',
- :group_id => '123', :id => '55' }
- )
+ should_route 'GET /groups/123/memberships/new' => 'principal_memberships#new', :group_id => '123'
+ should_route 'POST /groups/123/memberships' => 'principal_memberships#create', :group_id => '123'
+ should_route 'PUT /groups/123/memberships/55' => 'principal_memberships#update', :group_id => '123', :id => '55'
+ should_route 'DELETE /groups/123/memberships/55' => 'principal_memberships#destroy', :group_id => '123', :id => '55'
end
end
diff --git a/test/integration/routing/project_enumerations_test.rb b/test/integration/routing/project_enumerations_test.rb
index 3eda2c481..1be9ec8f2 100644
--- a/test/integration/routing/project_enumerations_test.rb
+++ b/test/integration/routing/project_enumerations_test.rb
@@ -17,17 +17,9 @@
require File.expand_path('../../../test_helper', __FILE__)
-class RoutingProjectEnumerationsTest < ActionDispatch::IntegrationTest
+class RoutingProjectEnumerationsTest < Redmine::RoutingTest
def test_project_enumerations
- assert_routing(
- { :method => 'put', :path => "/projects/64/enumerations" },
- { :controller => 'project_enumerations', :action => 'update',
- :project_id => '64' }
- )
- assert_routing(
- { :method => 'delete', :path => "/projects/64/enumerations" },
- { :controller => 'project_enumerations', :action => 'destroy',
- :project_id => '64' }
- )
+ should_route 'PUT /projects/foo/enumerations' => 'project_enumerations#update', :project_id => 'foo'
+ should_route 'DELETE /projects/foo/enumerations' => 'project_enumerations#destroy', :project_id => 'foo'
end
end
diff --git a/test/integration/routing/projects_test.rb b/test/integration/routing/projects_test.rb
index 1ad54a510..6714665ff 100644
--- a/test/integration/routing/projects_test.rb
+++ b/test/integration/routing/projects_test.rb
@@ -17,60 +17,23 @@
require File.expand_path('../../../test_helper', __FILE__)
-class RoutingProjectsTest < ActionDispatch::IntegrationTest
+class RoutingProjectsTest < Redmine::RoutingTest
def test_projects
- assert_routing(
- { :method => 'get', :path => "/projects" },
- { :controller => 'projects', :action => 'index' }
- )
- assert_routing(
- { :method => 'get', :path => "/projects.atom" },
- { :controller => 'projects', :action => 'index', :format => 'atom' }
- )
- assert_routing(
- { :method => 'get', :path => "/projects/new" },
- { :controller => 'projects', :action => 'new' }
- )
- assert_routing(
- { :method => 'get', :path => "/projects/test" },
- { :controller => 'projects', :action => 'show', :id => 'test' }
- )
- assert_routing(
- { :method => 'get', :path => "/projects/4223/settings" },
- { :controller => 'projects', :action => 'settings', :id => '4223' }
- )
- assert_routing(
- { :method => 'get', :path => "/projects/4223/settings/members" },
- { :controller => 'projects', :action => 'settings', :id => '4223',
- :tab => 'members' }
- )
- assert_routing(
- { :method => 'post', :path => "/projects" },
- { :controller => 'projects', :action => 'create' }
- )
- assert_routing(
- { :method => 'post', :path => "/projects/64/archive" },
- { :controller => 'projects', :action => 'archive', :id => '64' }
- )
- assert_routing(
- { :method => 'post', :path => "/projects/64/unarchive" },
- { :controller => 'projects', :action => 'unarchive', :id => '64' }
- )
- assert_routing(
- { :method => 'post', :path => "/projects/64/close" },
- { :controller => 'projects', :action => 'close', :id => '64' }
- )
- assert_routing(
- { :method => 'post', :path => "/projects/64/reopen" },
- { :controller => 'projects', :action => 'reopen', :id => '64' }
- )
- assert_routing(
- { :method => 'put', :path => "/projects/4223" },
- { :controller => 'projects', :action => 'update', :id => '4223' }
- )
- assert_routing(
- { :method => 'delete', :path => "/projects/64" },
- { :controller => 'projects', :action => 'destroy', :id => '64' }
- )
+ should_route 'GET /projects' => 'projects#index'
+ should_route 'GET /projects.atom' => 'projects#index', :format => 'atom'
+ should_route 'GET /projects/new' => 'projects#new'
+ should_route 'POST /projects' => 'projects#create'
+
+ should_route 'GET /projects/foo' => 'projects#show', :id => 'foo'
+ should_route 'PUT /projects/foo' => 'projects#update', :id => 'foo'
+ should_route 'DELETE /projects/foo' => 'projects#destroy', :id => 'foo'
+
+ should_route 'GET /projects/foo/settings' => 'projects#settings', :id => 'foo'
+ should_route 'GET /projects/foo/settings/members' => 'projects#settings', :id => 'foo', :tab => 'members'
+
+ should_route 'POST /projects/foo/archive' => 'projects#archive', :id => 'foo'
+ should_route 'POST /projects/foo/unarchive' => 'projects#unarchive', :id => 'foo'
+ should_route 'POST /projects/foo/close' => 'projects#close', :id => 'foo'
+ should_route 'POST /projects/foo/reopen' => 'projects#reopen', :id => 'foo'
end
end
diff --git a/test/integration/routing/queries_test.rb b/test/integration/routing/queries_test.rb
index 226a5b50c..904e20b92 100644
--- a/test/integration/routing/queries_test.rb
+++ b/test/integration/routing/queries_test.rb
@@ -17,38 +17,18 @@
require File.expand_path('../../../test_helper', __FILE__)
-class RoutingQueriesTest < ActionDispatch::IntegrationTest
+class RoutingQueriesTest < Redmine::RoutingTest
def test_queries
- assert_routing(
- { :method => 'get', :path => "/queries/new" },
- { :controller => 'queries', :action => 'new' }
- )
- assert_routing(
- { :method => 'post', :path => "/queries" },
- { :controller => 'queries', :action => 'create' }
- )
- assert_routing(
- { :method => 'get', :path => "/queries/1/edit" },
- { :controller => 'queries', :action => 'edit', :id => '1' }
- )
- assert_routing(
- { :method => 'put', :path => "/queries/1" },
- { :controller => 'queries', :action => 'update', :id => '1' }
- )
- assert_routing(
- { :method => 'delete', :path => "/queries/1" },
- { :controller => 'queries', :action => 'destroy', :id => '1' }
- )
+ should_route 'GET /queries/new' => 'queries#new'
+ should_route 'POST /queries' => 'queries#create'
+
+ should_route 'GET /queries/1/edit' => 'queries#edit', :id => '1'
+ should_route 'PUT /queries/1' => 'queries#update', :id => '1'
+ should_route 'DELETE /queries/1' => 'queries#destroy', :id => '1'
end
def test_queries_scoped_under_project
- assert_routing(
- { :method => 'get', :path => "/projects/redmine/queries/new" },
- { :controller => 'queries', :action => 'new', :project_id => 'redmine' }
- )
- assert_routing(
- { :method => 'post', :path => "/projects/redmine/queries" },
- { :controller => 'queries', :action => 'create', :project_id => 'redmine' }
- )
+ should_route 'GET /projects/foo/queries/new' => 'queries#new', :project_id => 'foo'
+ should_route 'POST /projects/foo/queries' => 'queries#create', :project_id => 'foo'
end
end
diff --git a/test/integration/routing/reports_test.rb b/test/integration/routing/reports_test.rb
index 2483682f4..7598d218e 100644
--- a/test/integration/routing/reports_test.rb
+++ b/test/integration/routing/reports_test.rb
@@ -17,16 +17,9 @@
require File.expand_path('../../../test_helper', __FILE__)
-class RoutingReportsTest < ActionDispatch::IntegrationTest
+class RoutingReportsTest < Redmine::RoutingTest
def test_reports
- assert_routing(
- { :method => 'get', :path => "/projects/567/issues/report" },
- { :controller => 'reports', :action => 'issue_report', :id => '567' }
- )
- assert_routing(
- { :method => 'get', :path => "/projects/567/issues/report/assigned_to" },
- { :controller => 'reports', :action => 'issue_report_details',
- :id => '567', :detail => 'assigned_to' }
- )
+ should_route 'GET /projects/foo/issues/report' => 'reports#issue_report', :id => 'foo'
+ should_route 'GET /projects/foo/issues/report/assigned_to' => 'reports#issue_report_details', :id => 'foo', :detail => 'assigned_to'
end
end
diff --git a/test/integration/routing/repositories_test.rb b/test/integration/routing/repositories_test.rb
index 0e46cb95c..104a58cb0 100644
--- a/test/integration/routing/repositories_test.rb
+++ b/test/integration/routing/repositories_test.rb
@@ -17,7 +17,7 @@
require File.expand_path('../../../test_helper', __FILE__)
-class RoutingRepositoriesTest < ActionDispatch::IntegrationTest
+class RoutingRepositoriesTest < Redmine::RoutingTest
def setup
@path_hash = repository_path_hash(%w[path to file.c])
assert_equal "path/to/file.c", @path_hash[:path]
@@ -25,407 +25,115 @@ class RoutingRepositoriesTest < ActionDispatch::IntegrationTest
end
def test_repositories_resources
- assert_routing(
- { :method => 'get',
- :path => "/projects/redmine/repositories/new" },
- { :controller => 'repositories', :action => 'new', :project_id => 'redmine' }
- )
- assert_routing(
- { :method => 'post',
- :path => "/projects/redmine/repositories" },
- { :controller => 'repositories', :action => 'create', :project_id => 'redmine' }
- )
- assert_routing(
- { :method => 'get',
- :path => "/repositories/1/edit" },
- { :controller => 'repositories', :action => 'edit', :id => '1' }
- )
- assert_routing(
- { :method => 'put',
- :path => "/repositories/1" },
- { :controller => 'repositories', :action => 'update', :id => '1' }
- )
- assert_routing(
- { :method => 'delete',
- :path => "/repositories/1" },
- { :controller => 'repositories', :action => 'destroy', :id => '1' }
- )
- ["get", "post"].each do |method|
- assert_routing(
- { :method => method,
- :path => "/repositories/1/committers" },
- { :controller => 'repositories', :action => 'committers', :id => '1' }
- )
- end
- end
+ should_route 'GET /projects/foo/repositories/new' => 'repositories#new', :project_id => 'foo'
+ should_route 'POST /projects/foo/repositories' => 'repositories#create', :project_id => 'foo'
+ should_route 'GET /repositories/1/edit' => 'repositories#edit', :id => '1'
+ should_route 'PUT /repositories/1' => 'repositories#update', :id => '1'
+ should_route 'DELETE /repositories/1' => 'repositories#destroy', :id => '1'
- def test_repositories_show
- assert_routing(
- { :method => 'get',
- :path => "/projects/redmine/repository" },
- { :controller => 'repositories', :action => 'show', :id => 'redmine' }
- )
+ should_route 'GET /repositories/1/committers' => 'repositories#committers', :id => '1'
+ should_route 'POST /repositories/1/committers' => 'repositories#committers', :id => '1'
end
def test_repositories
- assert_routing(
- { :method => 'get',
- :path => "/projects/redmine/repository/statistics" },
- { :controller => 'repositories', :action => 'stats', :id => 'redmine' }
- )
- assert_routing(
- { :method => 'get',
- :path => "/projects/redmine/repository/graph" },
- { :controller => 'repositories', :action => 'graph', :id => 'redmine' }
- )
- end
-
- def test_repositories_show_with_repository_id
- assert_routing(
- { :method => 'get',
- :path => "/projects/redmine/repository/foo" },
- { :controller => 'repositories', :action => 'show', :id => 'redmine', :repository_id => 'foo' }
- )
+ should_route 'GET /projects/foo/repository' => 'repositories#show', :id => 'foo'
+ should_route 'GET /projects/foo/repository/statistics' => 'repositories#stats', :id => 'foo'
+ should_route 'GET /projects/foo/repository/graph' => 'repositories#graph', :id => 'foo'
end
def test_repositories_with_repository_id
- assert_routing(
- { :method => 'get',
- :path => "/projects/redmine/repository/foo/statistics" },
- { :controller => 'repositories', :action => 'stats', :id => 'redmine', :repository_id => 'foo' }
- )
- assert_routing(
- { :method => 'get',
- :path => "/projects/redmine/repository/foo/graph" },
- { :controller => 'repositories', :action => 'graph', :id => 'redmine', :repository_id => 'foo' }
- )
+ should_route 'GET /projects/foo/repository/svn' => 'repositories#show', :id => 'foo', :repository_id => 'svn'
+ should_route 'GET /projects/foo/repository/svn/statistics' => 'repositories#stats', :id => 'foo', :repository_id => 'svn'
+ should_route 'GET /projects/foo/repository/svn/graph' => 'repositories#graph', :id => 'foo', :repository_id => 'svn'
end
def test_repositories_revisions
- empty_path_param = []
- 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/show" },
- { :controller => 'repositories', :action => 'show', :id => 'redmine',
- :rev => '2457' }
- )
- assert_routing(
- { :method => 'get',
- :path => "/projects/redmine/repository/revisions/2457/show/#{@path_hash[:path]}" },
- { :controller => 'repositories', :action => 'show', :id => 'redmine',
- :path => @path_hash[:param] , :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" },
- { :controller => 'repositories', :action => 'diff', :id => 'redmine',
- :rev => '2457', :format => 'diff' },
- {},
- { :format => 'diff' }
- )
- assert_routing(
- { :method => 'get',
- :path => "/projects/redmine/repository/revisions/2/diff/#{@path_hash[:path]}" },
- { :controller => 'repositories', :action => 'diff', :id => 'redmine',
- :path => @path_hash[:param], :rev => '2' }
- )
- assert_routing(
- { :method => 'get',
- :path => "/projects/redmine/repository/revisions/2/diff/#{@path_hash[:path]}" },
- { :controller => 'repositories', :action => 'diff', :id => 'redmine',
- :path => @path_hash[:param], :rev => '2', :format => 'diff' },
- {},
- { :format => 'diff' }
- )
- assert_routing(
- { :method => 'get',
- :path => "/projects/redmine/repository/revisions/2/entry/#{@path_hash[:path]}" },
- { :controller => 'repositories', :action => 'entry', :id => 'redmine',
- :path => @path_hash[:param], :rev => '2' }
- )
- assert_routing(
- { :method => 'get',
- :path => "/projects/redmine/repository/revisions/2/raw/#{@path_hash[:path]}" },
- { :controller => 'repositories', :action => 'raw', :id => 'redmine',
- :path => @path_hash[:param], :rev => '2' }
- )
- assert_routing(
- { :method => 'get',
- :path => "/projects/redmine/repository/revisions/2/annotate/#{@path_hash[:path]}" },
- { :controller => 'repositories', :action => 'annotate', :id => 'redmine',
- :path => @path_hash[:param], :rev => '2' }
- )
+ should_route 'GET /projects/foo/repository/revision' => 'repositories#revision', :id => 'foo'
+ should_route 'GET /projects/foo/repository/revisions' => 'repositories#revisions', :id => 'foo'
+ should_route 'GET /projects/foo/repository/revisions.atom' => 'repositories#revisions', :id => 'foo', :format => 'atom'
+
+ should_route 'GET /projects/foo/repository/revisions/2457' => 'repositories#revision', :id => 'foo', :rev => '2457'
+ should_route 'GET /projects/foo/repository/revisions/2457/show' => 'repositories#show', :id => 'foo', :rev => '2457'
+ should_route 'GET /projects/foo/repository/revisions/2457/diff' => 'repositories#diff', :id => 'foo', :rev => '2457'
+
+ should_route "GET /projects/foo/repository/revisions/2457/show/#{@path_hash[:path]}" => 'repositories#show',
+ :id => 'foo', :rev => '2457', :path => @path_hash[:param]
+ should_route "GET /projects/foo/repository/revisions/2457/diff/#{@path_hash[:path]}" => 'repositories#diff',
+ :id => 'foo', :rev => '2457', :path => @path_hash[:param]
+ should_route "GET /projects/foo/repository/revisions/2457/entry/#{@path_hash[:path]}" => 'repositories#entry',
+ :id => 'foo', :rev => '2457', :path => @path_hash[:param]
+ should_route "GET /projects/foo/repository/revisions/2457/raw/#{@path_hash[:path]}" => 'repositories#raw',
+ :id => 'foo', :rev => '2457', :path => @path_hash[:param]
+ should_route "GET /projects/foo/repository/revisions/2457/annotate/#{@path_hash[:path]}" => 'repositories#annotate',
+ :id => 'foo', :rev => '2457', :path => @path_hash[:param]
end
def test_repositories_revisions_with_repository_id
- empty_path_param = []
- assert_routing(
- { :method => 'get',
- :path => "/projects/redmine/repository/foo/revisions" },
- { :controller => 'repositories', :action => 'revisions', :id => 'redmine', :repository_id => 'foo' }
- )
- assert_routing(
- { :method => 'get',
- :path => "/projects/redmine/repository/foo/revisions.atom" },
- { :controller => 'repositories', :action => 'revisions', :id => 'redmine', :repository_id => 'foo',
- :format => 'atom' }
- )
- assert_routing(
- { :method => 'get',
- :path => "/projects/redmine/repository/foo/revisions/2457" },
- { :controller => 'repositories', :action => 'revision', :id => 'redmine', :repository_id => 'foo',
- :rev => '2457' }
- )
- assert_routing(
- { :method => 'get',
- :path => "/projects/redmine/repository/foo/revisions/2457/show" },
- { :controller => 'repositories', :action => 'show', :id => 'redmine', :repository_id => 'foo',
- :rev => '2457' }
- )
- assert_routing(
- { :method => 'get',
- :path => "/projects/redmine/repository/foo/revisions/2457/show/#{@path_hash[:path]}" },
- { :controller => 'repositories', :action => 'show', :id => 'redmine', :repository_id => 'foo',
- :path => @path_hash[:param] , :rev => '2457'}
- )
- assert_routing(
- { :method => 'get',
- :path => "/projects/redmine/repository/foo/revisions/2457/diff" },
- { :controller => 'repositories', :action => 'diff', :id => 'redmine', :repository_id => 'foo',
- :rev => '2457' }
- )
- assert_routing(
- { :method => 'get',
- :path => "/projects/redmine/repository/foo/revisions/2457/diff" },
- { :controller => 'repositories', :action => 'diff', :id => 'redmine', :repository_id => 'foo',
- :rev => '2457', :format => 'diff' },
- {},
- { :format => 'diff' }
- )
- assert_routing(
- { :method => 'get',
- :path => "/projects/redmine/repository/foo/revisions/2/diff/#{@path_hash[:path]}" },
- { :controller => 'repositories', :action => 'diff', :id => 'redmine', :repository_id => 'foo',
- :path => @path_hash[:param], :rev => '2' }
- )
- assert_routing(
- { :method => 'get',
- :path => "/projects/redmine/repository/foo/revisions/2/diff/#{@path_hash[:path]}" },
- { :controller => 'repositories', :action => 'diff', :id => 'redmine', :repository_id => 'foo',
- :path => @path_hash[:param], :rev => '2', :format => 'diff' },
- {},
- { :format => 'diff' }
- )
- assert_routing(
- { :method => 'get',
- :path => "/projects/redmine/repository/foo/revisions/2/entry/#{@path_hash[:path]}" },
- { :controller => 'repositories', :action => 'entry', :id => 'redmine', :repository_id => 'foo',
- :path => @path_hash[:param], :rev => '2' }
- )
- assert_routing(
- { :method => 'get',
- :path => "/projects/redmine/repository/foo/revisions/2/raw/#{@path_hash[:path]}" },
- { :controller => 'repositories', :action => 'raw', :id => 'redmine', :repository_id => 'foo',
- :path => @path_hash[:param], :rev => '2' }
- )
- assert_routing(
- { :method => 'get',
- :path => "/projects/redmine/repository/foo/revisions/2/annotate/#{@path_hash[:path]}" },
- { :controller => 'repositories', :action => 'annotate', :id => 'redmine', :repository_id => 'foo',
- :path => @path_hash[:param], :rev => '2' }
- )
+ should_route 'GET /projects/foo/repository/foo/revision' => 'repositories#revision', :id => 'foo', :repository_id => 'foo'
+ should_route 'GET /projects/foo/repository/foo/revisions' => 'repositories#revisions', :id => 'foo', :repository_id => 'foo'
+ should_route 'GET /projects/foo/repository/foo/revisions.atom' => 'repositories#revisions', :id => 'foo', :repository_id => 'foo', :format => 'atom'
+
+ should_route 'GET /projects/foo/repository/foo/revisions/2457' => 'repositories#revision', :id => 'foo', :repository_id => 'foo', :rev => '2457'
+ should_route 'GET /projects/foo/repository/foo/revisions/2457/show' => 'repositories#show', :id => 'foo', :repository_id => 'foo', :rev => '2457'
+ should_route 'GET /projects/foo/repository/foo/revisions/2457/diff' => 'repositories#diff', :id => 'foo', :repository_id => 'foo', :rev => '2457'
+
+ should_route "GET /projects/foo/repository/foo/revisions/2457/show/#{@path_hash[:path]}" => 'repositories#show',
+ :id => 'foo', :repository_id => 'foo', :rev => '2457', :path => @path_hash[:param]
+ should_route "GET /projects/foo/repository/foo/revisions/2457/diff/#{@path_hash[:path]}" => 'repositories#diff',
+ :id => 'foo', :repository_id => 'foo', :rev => '2457', :path => @path_hash[:param]
+ should_route "GET /projects/foo/repository/foo/revisions/2457/entry/#{@path_hash[:path]}" => 'repositories#entry',
+ :id => 'foo', :repository_id => 'foo', :rev => '2457', :path => @path_hash[:param]
+ should_route "GET /projects/foo/repository/foo/revisions/2457/raw/#{@path_hash[:path]}" => 'repositories#raw',
+ :id => 'foo', :repository_id => 'foo', :rev => '2457', :path => @path_hash[:param]
+ should_route "GET /projects/foo/repository/foo/revisions/2457/annotate/#{@path_hash[:path]}" => 'repositories#annotate',
+ :id => 'foo', :repository_id => 'foo', :rev => '2457', :path => @path_hash[:param]
end
def test_repositories_non_revisions_path
- assert_routing(
- { :method => 'get',
- :path => "/projects/redmine/repository/changes" },
- { :controller => 'repositories', :action => 'changes', :id => 'redmine' }
- )
- ['2457', 'master', 'slash/slash'].each do |rev|
- assert_routing(
- { :method => 'get',
- :path => "/projects/redmine/repository/changes" },
- { :controller => 'repositories', :action => 'changes', :id => 'redmine',
- :rev => rev },
- {},
- { :rev => rev }
- )
- end
- ['2457', 'master', 'slash/slash'].each do |rev|
- assert_routing(
- { :method => 'get',
- :path => "/projects/redmine/repository/changes/#{@path_hash[:path]}" },
- { :controller => 'repositories', :action => 'changes', :id => 'redmine',
- :path => @path_hash[:param], :rev => rev },
- {},
- { :rev => rev }
- )
- end
- assert_routing(
- { :method => 'get',
- :path => "/projects/redmine/repository/diff/#{@path_hash[:path]}" },
- { :controller => 'repositories', :action => 'diff', :id => 'redmine',
- :path => @path_hash[:param] }
- )
- assert_routing(
- { :method => 'get',
- :path => "/projects/redmine/repository/browse/#{@path_hash[:path]}" },
- { :controller => 'repositories', :action => 'browse', :id => 'redmine',
- :path => @path_hash[:param] }
- )
- assert_routing(
- { :method => 'get',
- :path => "/projects/redmine/repository/entry/#{@path_hash[:path]}" },
- { :controller => 'repositories', :action => 'entry', :id => 'redmine',
- :path => @path_hash[:param] }
- )
- assert_routing(
- { :method => 'get',
- :path => "/projects/redmine/repository/raw/#{@path_hash[:path]}" },
- { :controller => 'repositories', :action => 'raw', :id => 'redmine',
- :path => @path_hash[:param] }
- )
- assert_routing(
- { :method => 'get',
- :path => "/projects/redmine/repository/annotate/#{@path_hash[:path]}" },
- { :controller => 'repositories', :action => 'annotate', :id => 'redmine',
- :path => @path_hash[:param] }
- )
- assert_routing(
- { :method => 'get',
- :path => "/projects/redmine/repository/changes/#{@path_hash[:path]}" },
- { :controller => 'repositories', :action => 'changes', :id => 'redmine',
- :path => @path_hash[:param] }
- )
- assert_routing(
- { :method => 'get',
- :path => "/projects/redmine/repository/revision" },
- { :controller => 'repositories', :action => 'revision', :id => 'redmine' }
- )
+ should_route 'GET /projects/foo/repository/changes' => 'repositories#changes', :id => 'foo'
+
+ should_route "GET /projects/foo/repository/changes/#{@path_hash[:path]}" => 'repositories#changes',
+ :id => 'foo', :path => @path_hash[:param]
+ should_route "GET /projects/foo/repository/diff/#{@path_hash[:path]}" => 'repositories#diff',
+ :id => 'foo', :path => @path_hash[:param]
+ should_route "GET /projects/foo/repository/browse/#{@path_hash[:path]}" => 'repositories#browse',
+ :id => 'foo', :path => @path_hash[:param]
+ should_route "GET /projects/foo/repository/entry/#{@path_hash[:path]}" => 'repositories#entry',
+ :id => 'foo', :path => @path_hash[:param]
+ should_route "GET /projects/foo/repository/raw/#{@path_hash[:path]}" => 'repositories#raw',
+ :id => 'foo', :path => @path_hash[:param]
+ should_route "GET /projects/foo/repository/annotate/#{@path_hash[:path]}" => 'repositories#annotate',
+ :id => 'foo', :path => @path_hash[:param]
end
def test_repositories_non_revisions_path_with_repository_id
- assert_routing(
- { :method => 'get',
- :path => "/projects/redmine/repository/foo/changes" },
- { :controller => 'repositories', :action => 'changes',
- :id => 'redmine', :repository_id => 'foo' }
- )
- ['2457', 'master', 'slash/slash'].each do |rev|
- assert_routing(
- { :method => 'get',
- :path => "/projects/redmine/repository/foo/changes" },
- { :controller => 'repositories', :action => 'changes',
- :id => 'redmine',
- :repository_id => 'foo', :rev => rev },
- {},
- { :rev => rev }
- )
- end
- ['2457', 'master', 'slash/slash'].each do |rev|
- assert_routing(
- { :method => 'get',
- :path => "/projects/redmine/repository/foo/changes/#{@path_hash[:path]}" },
- { :controller => 'repositories', :action => 'changes', :id => 'redmine',
- :repository_id => 'foo', :path => @path_hash[:param], :rev => rev },
- {},
- { :rev => rev }
- )
- end
- assert_routing(
- { :method => 'get',
- :path => "/projects/redmine/repository/foo/diff/#{@path_hash[:path]}" },
- { :controller => 'repositories', :action => 'diff', :id => 'redmine', :repository_id => 'foo',
- :path => @path_hash[:param] }
- )
- assert_routing(
- { :method => 'get',
- :path => "/projects/redmine/repository/foo/browse/#{@path_hash[:path]}" },
- { :controller => 'repositories', :action => 'browse', :id => 'redmine', :repository_id => 'foo',
- :path => @path_hash[:param] }
- )
- assert_routing(
- { :method => 'get',
- :path => "/projects/redmine/repository/foo/entry/#{@path_hash[:path]}" },
- { :controller => 'repositories', :action => 'entry', :id => 'redmine', :repository_id => 'foo',
- :path => @path_hash[:param] }
- )
- assert_routing(
- { :method => 'get',
- :path => "/projects/redmine/repository/foo/raw/#{@path_hash[:path]}" },
- { :controller => 'repositories', :action => 'raw', :id => 'redmine', :repository_id => 'foo',
- :path => @path_hash[:param] }
- )
- assert_routing(
- { :method => 'get',
- :path => "/projects/redmine/repository/foo/annotate/#{@path_hash[:path]}" },
- { :controller => 'repositories', :action => 'annotate', :id => 'redmine', :repository_id => 'foo',
- :path => @path_hash[:param] }
- )
- assert_routing(
- { :method => 'get',
- :path => "/projects/redmine/repository/foo/changes/#{@path_hash[:path]}" },
- { :controller => 'repositories', :action => 'changes', :id => 'redmine', :repository_id => 'foo',
- :path => @path_hash[:param] }
- )
- assert_routing(
- { :method => 'get',
- :path => "/projects/redmine/repository/foo/revision" },
- { :controller => 'repositories', :action => 'revision', :id => 'redmine', :repository_id => 'foo'}
- )
+ should_route 'GET /projects/foo/repository/svn/changes' => 'repositories#changes', :id => 'foo', :repository_id => 'svn'
+
+ should_route "GET /projects/foo/repository/svn/changes/#{@path_hash[:path]}" => 'repositories#changes',
+ :id => 'foo', :repository_id => 'svn', :path => @path_hash[:param]
+ should_route "GET /projects/foo/repository/svn/diff/#{@path_hash[:path]}" => 'repositories#diff',
+ :id => 'foo', :repository_id => 'svn', :path => @path_hash[:param]
+ should_route "GET /projects/foo/repository/svn/browse/#{@path_hash[:path]}" => 'repositories#browse',
+ :id => 'foo', :repository_id => 'svn', :path => @path_hash[:param]
+ should_route "GET /projects/foo/repository/svn/entry/#{@path_hash[:path]}" => 'repositories#entry',
+ :id => 'foo', :repository_id => 'svn', :path => @path_hash[:param]
+ should_route "GET /projects/foo/repository/svn/raw/#{@path_hash[:path]}" => 'repositories#raw',
+ :id => 'foo', :repository_id => 'svn', :path => @path_hash[:param]
+ should_route "GET /projects/foo/repository/svn/annotate/#{@path_hash[:path]}" => 'repositories#annotate',
+ :id => 'foo', :repository_id => 'svn', :path => @path_hash[:param]
end
def test_repositories_related_issues
- assert_routing(
- { :method => 'post',
- :path => "/projects/redmine/repository/revisions/123/issues" },
- { :controller => 'repositories', :action => 'add_related_issue',
- :id => 'redmine', :rev => '123' }
- )
- assert_routing(
- { :method => 'delete',
- :path => "/projects/redmine/repository/revisions/123/issues/25" },
- { :controller => 'repositories', :action => 'remove_related_issue',
- :id => 'redmine', :rev => '123', :issue_id => '25' }
- )
+ should_route 'POST /projects/foo/repository/revisions/123/issues' => 'repositories#add_related_issue',
+ :id => 'foo', :rev => '123'
+ should_route 'DELETE /projects/foo/repository/revisions/123/issues/25' => 'repositories#remove_related_issue',
+ :id => 'foo', :rev => '123', :issue_id => '25'
end
def test_repositories_related_issues_with_repository_id
- assert_routing(
- { :method => 'post',
- :path => "/projects/redmine/repository/foo/revisions/123/issues" },
- { :controller => 'repositories', :action => 'add_related_issue',
- :id => 'redmine', :repository_id => 'foo', :rev => '123' }
- )
- assert_routing(
- { :method => 'delete',
- :path => "/projects/redmine/repository/foo/revisions/123/issues/25" },
- { :controller => 'repositories', :action => 'remove_related_issue',
- :id => 'redmine', :repository_id => 'foo', :rev => '123', :issue_id => '25' }
- )
+ should_route 'POST /projects/foo/repository/svn/revisions/123/issues' => 'repositories#add_related_issue',
+ :id => 'foo', :repository_id => 'svn', :rev => '123'
+ should_route 'DELETE /projects/foo/repository/svn/revisions/123/issues/25' => 'repositories#remove_related_issue',
+ :id => 'foo', :repository_id => 'svn', :rev => '123', :issue_id => '25'
end
end
diff --git a/test/integration/routing/roles_test.rb b/test/integration/routing/roles_test.rb
index b836a1090..e422c06c9 100644
--- a/test/integration/routing/roles_test.rb
+++ b/test/integration/routing/roles_test.rb
@@ -17,37 +17,17 @@
require File.expand_path('../../../test_helper', __FILE__)
-class RoutingRolesTest < ActionDispatch::IntegrationTest
+class RoutingRolesTest < Redmine::RoutingTest
def test_roles
- assert_routing(
- { :method => 'get', :path => "/roles" },
- { :controller => 'roles', :action => 'index' }
- )
- assert_routing(
- { :method => 'get', :path => "/roles/new" },
- { :controller => 'roles', :action => 'new' }
- )
- assert_routing(
- { :method => 'post', :path => "/roles" },
- { :controller => 'roles', :action => 'create' }
- )
- assert_routing(
- { :method => 'get', :path => "/roles/2/edit" },
- { :controller => 'roles', :action => 'edit', :id => '2' }
- )
- assert_routing(
- { :method => 'put', :path => "/roles/2" },
- { :controller => 'roles', :action => 'update', :id => '2' }
- )
- assert_routing(
- { :method => 'delete', :path => "/roles/2" },
- { :controller => 'roles', :action => 'destroy', :id => '2' }
- )
- ["get", "post"].each do |method|
- assert_routing(
- { :method => method, :path => "/roles/permissions" },
- { :controller => 'roles', :action => 'permissions' }
- )
- end
+ should_route 'GET /roles' => 'roles#index'
+ should_route 'GET /roles/new' => 'roles#new'
+ should_route 'POST /roles' => 'roles#create'
+
+ should_route 'GET /roles/2/edit' => 'roles#edit', :id => '2'
+ should_route 'PUT /roles/2' => 'roles#update', :id => '2'
+ should_route 'DELETE /roles/2' => 'roles#destroy', :id => '2'
+
+ should_route 'GET /roles/permissions' => 'roles#permissions'
+ should_route 'POST /roles/permissions' => 'roles#permissions'
end
end
diff --git a/test/integration/routing/search_test.rb b/test/integration/routing/search_test.rb
index 6ea40fd73..79d41bda9 100644
--- a/test/integration/routing/search_test.rb
+++ b/test/integration/routing/search_test.rb
@@ -17,15 +17,9 @@
require File.expand_path('../../../test_helper', __FILE__)
-class RoutingSearchTest < ActionDispatch::IntegrationTest
+class RoutingSearchTest < Redmine::RoutingTest
def test_search
- assert_routing(
- { :method => 'get', :path => "/search" },
- { :controller => 'search', :action => 'index' }
- )
- assert_routing(
- { :method => 'get', :path => "/projects/foo/search" },
- { :controller => 'search', :action => 'index', :id => 'foo' }
- )
+ should_route 'GET /search' => 'search#index'
+ should_route 'GET /projects/foo/search' => 'search#index', :id => 'foo'
end
end
diff --git a/test/integration/routing/settings_test.rb b/test/integration/routing/settings_test.rb
index 4cc986d27..d2ee669f7 100644
--- a/test/integration/routing/settings_test.rb
+++ b/test/integration/routing/settings_test.rb
@@ -17,24 +17,13 @@
require File.expand_path('../../../test_helper', __FILE__)
-class RoutingSettingsTest < ActionDispatch::IntegrationTest
+class RoutingSettingsTest < Redmine::RoutingTest
def test_settings
- assert_routing(
- { :method => 'get', :path => "/settings" },
- { :controller => 'settings', :action => 'index' }
- )
- ["get", "post"].each do |method|
- assert_routing(
- { :method => method, :path => "/settings/edit" },
- { :controller => 'settings', :action => 'edit' }
- )
- end
- ["get", "post"].each do |method|
- assert_routing(
- { :method => method, :path => "/settings/plugin/testid" },
- { :controller => 'settings', :action => 'plugin',
- :id => 'testid' }
- )
- end
+ should_route 'GET /settings' => 'settings#index'
+ should_route 'GET /settings/edit' => 'settings#edit'
+ should_route 'POST /settings/edit' => 'settings#edit'
+
+ should_route 'GET /settings/plugin/testid' => 'settings#plugin', :id => 'testid'
+ should_route 'POST /settings/plugin/testid' => 'settings#plugin', :id => 'testid'
end
end
diff --git a/test/integration/routing/sys_test.rb b/test/integration/routing/sys_test.rb
index 65a325367..ef7198686 100644
--- a/test/integration/routing/sys_test.rb
+++ b/test/integration/routing/sys_test.rb
@@ -17,23 +17,11 @@
require File.expand_path('../../../test_helper', __FILE__)
-class RoutingSysTest < ActionDispatch::IntegrationTest
+class RoutingSysTest < Redmine::RoutingTest
def test_sys
- assert_routing(
- { :method => 'get', :path => "/sys/projects" },
- { :controller => 'sys', :action => 'projects' }
- )
- assert_routing(
- { :method => 'post', :path => "/sys/projects/testid/repository" },
- { :controller => 'sys', :action => 'create_project_repository', :id => 'testid' }
- )
- assert_routing(
- { :method => 'get', :path => "/sys/fetch_changesets" },
- { :controller => 'sys', :action => 'fetch_changesets' }
- )
- assert_routing(
- { :method => 'post', :path => "/sys/fetch_changesets" },
- { :controller => 'sys', :action => 'fetch_changesets' }
- )
+ should_route 'GET /sys/projects' => 'sys#projects'
+ should_route 'POST /sys/projects/foo/repository' => 'sys#create_project_repository', :id => 'foo'
+ should_route 'GET /sys/fetch_changesets' => 'sys#fetch_changesets'
+ should_route 'POST /sys/fetch_changesets' => 'sys#fetch_changesets'
end
end
diff --git a/test/integration/routing/timelog_test.rb b/test/integration/routing/timelog_test.rb
index 963e16975..fc5c89644 100644
--- a/test/integration/routing/timelog_test.rb
+++ b/test/integration/routing/timelog_test.rb
@@ -17,173 +17,59 @@
require File.expand_path('../../../test_helper', __FILE__)
-class RoutingTimelogsTest < ActionDispatch::IntegrationTest
+class RoutingTimelogsTest < Redmine::RoutingTest
def test_timelogs_global
- assert_routing(
- { :method => 'get', :path => "/time_entries" },
- { :controller => 'timelog', :action => 'index' }
- )
- assert_routing(
- { :method => 'get', :path => "/time_entries.csv" },
- { :controller => 'timelog', :action => 'index', :format => 'csv' }
- )
- assert_routing(
- { :method => 'get', :path => "/time_entries.atom" },
- { :controller => 'timelog', :action => 'index', :format => 'atom' }
- )
- assert_routing(
- { :method => 'get', :path => "/time_entries/new" },
- { :controller => 'timelog', :action => 'new' }
- )
- assert_routing(
- { :method => 'get', :path => "/time_entries/22/edit" },
- { :controller => 'timelog', :action => 'edit', :id => '22' }
- )
- assert_routing(
- { :method => 'post', :path => "/time_entries" },
- { :controller => 'timelog', :action => 'create' }
- )
- assert_routing(
- { :method => 'put', :path => "/time_entries/22" },
- { :controller => 'timelog', :action => 'update', :id => '22' }
- )
- assert_routing(
- { :method => 'delete', :path => "/time_entries/55" },
- { :controller => 'timelog', :action => 'destroy', :id => '55' }
- )
+ should_route 'GET /time_entries' => 'timelog#index'
+ should_route 'GET /time_entries.csv' => 'timelog#index', :format => 'csv'
+ should_route 'GET /time_entries.atom' => 'timelog#index', :format => 'atom'
+ should_route 'GET /time_entries/new' => 'timelog#new'
+ should_route 'POST /time_entries' => 'timelog#create'
+
+ should_route 'GET /time_entries/22/edit' => 'timelog#edit', :id => '22'
+ should_route 'PUT /time_entries/22' => 'timelog#update', :id => '22'
+ should_route 'DELETE /time_entries/22' => 'timelog#destroy', :id => '22'
end
def test_timelogs_scoped_under_project
- assert_routing(
- { :method => 'get', :path => "/projects/567/time_entries" },
- { :controller => 'timelog', :action => 'index', :project_id => '567' }
- )
- assert_routing(
- { :method => 'get', :path => "/projects/567/time_entries.csv" },
- { :controller => 'timelog', :action => 'index', :project_id => '567',
- :format => 'csv' }
- )
- assert_routing(
- { :method => 'get', :path => "/projects/567/time_entries.atom" },
- { :controller => 'timelog', :action => 'index', :project_id => '567',
- :format => 'atom' }
- )
- assert_routing(
- { :method => 'get', :path => "/projects/567/time_entries/new" },
- { :controller => 'timelog', :action => 'new', :project_id => '567' }
- )
- assert_routing(
- { :method => 'get', :path => "/projects/567/time_entries/22/edit" },
- { :controller => 'timelog', :action => 'edit',
- :id => '22', :project_id => '567' }
- )
- assert_routing(
- { :method => 'post', :path => "/projects/567/time_entries" },
- { :controller => 'timelog', :action => 'create',
- :project_id => '567' }
- )
- assert_routing(
- { :method => 'put', :path => "/projects/567/time_entries/22" },
- { :controller => 'timelog', :action => 'update',
- :id => '22', :project_id => '567' }
- )
- assert_routing(
- { :method => 'delete', :path => "/projects/567/time_entries/55" },
- { :controller => 'timelog', :action => 'destroy',
- :id => '55', :project_id => '567' }
- )
+ should_route 'GET /projects/foo/time_entries' => 'timelog#index', :project_id => 'foo'
+ should_route 'GET /projects/foo/time_entries.csv' => 'timelog#index', :project_id => 'foo', :format => 'csv'
+ should_route 'GET /projects/foo/time_entries.atom' => 'timelog#index', :project_id => 'foo', :format => 'atom'
+ should_route 'GET /projects/foo/time_entries/new' => 'timelog#new', :project_id => 'foo'
+ should_route 'POST /projects/foo/time_entries' => 'timelog#create', :project_id => 'foo'
+
+ # TODO: unused?
+ should_route 'GET /projects/foo/time_entries/22/edit' => 'timelog#edit', :project_id => 'foo', :id => '22'
+ should_route 'PUT /projects/foo/time_entries/22' => 'timelog#update', :project_id => 'foo', :id => '22'
+ should_route 'DELETE /projects/foo/time_entries/22' => 'timelog#destroy', :project_id => 'foo', :id => '22'
end
def test_timelogs_scoped_under_issues
- assert_routing(
- { :method => 'get', :path => "/issues/234/time_entries" },
- { :controller => 'timelog', :action => 'index', :issue_id => '234' }
- )
- assert_routing(
- { :method => 'get', :path => "/issues/234/time_entries.csv" },
- { :controller => 'timelog', :action => 'index', :issue_id => '234',
- :format => 'csv' }
- )
- assert_routing(
- { :method => 'get', :path => "/issues/234/time_entries.atom" },
- { :controller => 'timelog', :action => 'index', :issue_id => '234',
- :format => 'atom' }
- )
- assert_routing(
- { :method => 'get', :path => "/issues/234/time_entries/new" },
- { :controller => 'timelog', :action => 'new', :issue_id => '234' }
- )
- assert_routing(
- { :method => 'get', :path => "/issues/234/time_entries/22/edit" },
- { :controller => 'timelog', :action => 'edit', :id => '22',
- :issue_id => '234' }
- )
- assert_routing(
- { :method => 'post', :path => "/issues/234/time_entries" },
- { :controller => 'timelog', :action => 'create', :issue_id => '234' }
- )
- assert_routing(
- { :method => 'put', :path => "/issues/234/time_entries/22" },
- { :controller => 'timelog', :action => 'update', :id => '22',
- :issue_id => '234' }
- )
- assert_routing(
- { :method => 'delete', :path => "/issues/234/time_entries/55" },
- { :controller => 'timelog', :action => 'destroy', :id => '55',
- :issue_id => '234' }
- )
+ should_route 'GET /issues/234/time_entries' => 'timelog#index', :issue_id => '234'
+ should_route 'GET /issues/234/time_entries.csv' => 'timelog#index', :issue_id => '234', :format => 'csv'
+ should_route 'GET /issues/234/time_entries.atom' => 'timelog#index', :issue_id => '234', :format => 'atom'
+ should_route 'GET /issues/234/time_entries/new' => 'timelog#new', :issue_id => '234'
+ should_route 'POST /issues/234/time_entries' => 'timelog#create', :issue_id => '234'
+
+ # TODO: unused?
+ should_route 'GET /issues/234/time_entries/22/edit' => 'timelog#edit', :issue_id => '234', :id => '22'
+ should_route 'PUT /issues/234/time_entries/22' => 'timelog#update', :issue_id => '234', :id => '22'
+ should_route 'DELETE /issues/234/time_entries/22' => 'timelog#destroy', :issue_id => '234', :id => '22'
end
def test_timelogs_report
- assert_routing(
- { :method => 'get',
- :path => "/time_entries/report" },
- { :controller => 'timelog', :action => 'report' }
- )
- assert_routing(
- { :method => 'get',
- :path => "/time_entries/report.csv" },
- { :controller => 'timelog', :action => 'report', :format => 'csv' }
- )
- assert_routing(
- { :method => 'get',
- :path => "/issues/234/time_entries/report" },
- { :controller => 'timelog', :action => 'report', :issue_id => '234' }
- )
- assert_routing(
- { :method => 'get',
- :path => "/issues/234/time_entries/report.csv" },
- { :controller => 'timelog', :action => 'report', :issue_id => '234',
- :format => 'csv' }
- )
- assert_routing(
- { :method => 'get',
- :path => "/projects/567/time_entries/report" },
- { :controller => 'timelog', :action => 'report', :project_id => '567' }
- )
- assert_routing(
- { :method => 'get',
- :path => "/projects/567/time_entries/report.csv" },
- { :controller => 'timelog', :action => 'report', :project_id => '567',
- :format => 'csv' }
- )
+ should_route 'GET /time_entries/report' => 'timelog#report'
+ should_route 'GET /time_entries/report.csv' => 'timelog#report', :format => 'csv'
+
+ should_route 'GET /projects/foo/time_entries/report' => 'timelog#report', :project_id => 'foo'
+ should_route 'GET /projects/foo/time_entries/report.csv' => 'timelog#report', :project_id => 'foo', :format => 'csv'
+
+ should_route 'GET /issues/234/time_entries/report' => 'timelog#report', :issue_id => '234'
+ should_route 'GET /issues/234/time_entries/report.csv' => 'timelog#report', :issue_id => '234', :format => 'csv'
end
def test_timelogs_bulk_edit
- assert_routing(
- { :method => 'delete',
- :path => "/time_entries/destroy" },
- { :controller => 'timelog', :action => 'destroy' }
- )
- assert_routing(
- { :method => 'post',
- :path => "/time_entries/bulk_update" },
- { :controller => 'timelog', :action => 'bulk_update' }
- )
- assert_routing(
- { :method => 'get',
- :path => "/time_entries/bulk_edit" },
- { :controller => 'timelog', :action => 'bulk_edit' }
- )
+ should_route 'GET /time_entries/bulk_edit' => 'timelog#bulk_edit'
+ should_route 'POST /time_entries/bulk_update' => 'timelog#bulk_update'
+ should_route 'DELETE /time_entries/destroy' => 'timelog#destroy'
end
end
diff --git a/test/integration/routing/trackers_test.rb b/test/integration/routing/trackers_test.rb
index 05724c92e..0a01bd6ad 100644
--- a/test/integration/routing/trackers_test.rb
+++ b/test/integration/routing/trackers_test.rb
@@ -17,41 +17,17 @@
require File.expand_path('../../../test_helper', __FILE__)
-class RoutingTrackersTest < ActionDispatch::IntegrationTest
+class RoutingTrackersTest < Redmine::RoutingTest
def test_trackers
- assert_routing(
- { :method => 'get', :path => "/trackers" },
- { :controller => 'trackers', :action => 'index' }
- )
- assert_routing(
- { :method => 'post', :path => "/trackers" },
- { :controller => 'trackers', :action => 'create' }
- )
- assert_routing(
- { :method => 'get', :path => "/trackers/new" },
- { :controller => 'trackers', :action => 'new' }
- )
- assert_routing(
- { :method => 'get', :path => "/trackers/1/edit" },
- { :controller => 'trackers', :action => 'edit', :id => '1' }
- )
- assert_routing(
- { :method => 'put', :path => "/trackers/1" },
- { :controller => 'trackers', :action => 'update',
- :id => '1' }
- )
- assert_routing(
- { :method => 'delete', :path => "/trackers/1" },
- { :controller => 'trackers', :action => 'destroy',
- :id => '1' }
- )
- assert_routing(
- { :method => 'get', :path => "/trackers/fields" },
- { :controller => 'trackers', :action => 'fields' }
- )
- assert_routing(
- { :method => 'post', :path => "/trackers/fields" },
- { :controller => 'trackers', :action => 'fields' }
- )
+ should_route 'GET /trackers' => 'trackers#index'
+ should_route 'GET /trackers/new' => 'trackers#new'
+ should_route 'POST /trackers' => 'trackers#create'
+
+ should_route 'GET /trackers/1/edit' => 'trackers#edit', :id => '1'
+ should_route 'PUT /trackers/1' => 'trackers#update', :id => '1'
+ should_route 'DELETE /trackers/1' => 'trackers#destroy', :id => '1'
+
+ should_route 'GET /trackers/fields' => 'trackers#fields'
+ should_route 'POST /trackers/fields' => 'trackers#fields'
end
end
diff --git a/test/integration/routing/users_test.rb b/test/integration/routing/users_test.rb
index fad01fbbb..cc37f1123 100644
--- a/test/integration/routing/users_test.rb
+++ b/test/integration/routing/users_test.rb
@@ -17,39 +17,16 @@
require File.expand_path('../../../test_helper', __FILE__)
-class RoutingUsersTest < ActionDispatch::IntegrationTest
+class RoutingUsersTest < Redmine::RoutingTest
def test_users
- assert_routing(
- { :method => 'get', :path => "/users" },
- { :controller => 'users', :action => 'index' }
- )
- assert_routing(
- { :method => 'get', :path => "/users/44" },
- { :controller => 'users', :action => 'show', :id => '44' }
- )
- assert_routing(
- { :method => 'get', :path => "/users/current" },
- { :controller => 'users', :action => 'show', :id => 'current' }
- )
- assert_routing(
- { :method => 'get', :path => "/users/new" },
- { :controller => 'users', :action => 'new' }
- )
- assert_routing(
- { :method => 'get', :path => "/users/444/edit" },
- { :controller => 'users', :action => 'edit', :id => '444' }
- )
- assert_routing(
- { :method => 'post', :path => "/users" },
- { :controller => 'users', :action => 'create' }
- )
- assert_routing(
- { :method => 'put', :path => "/users/444" },
- { :controller => 'users', :action => 'update', :id => '444' }
- )
- assert_routing(
- { :method => 'delete', :path => "/users/44" },
- { :controller => 'users', :action => 'destroy', :id => '44' }
- )
+ should_route 'GET /users' => 'users#index'
+ should_route 'GET /users/new' => 'users#new'
+ should_route 'POST /users' => 'users#create'
+
+ should_route 'GET /users/44' => 'users#show', :id => '44'
+ should_route 'GET /users/current' => 'users#show', :id => 'current'
+ should_route 'GET /users/44/edit' => 'users#edit', :id => '44'
+ should_route 'PUT /users/44' => 'users#update', :id => '44'
+ should_route 'DELETE /users/44' => 'users#destroy', :id => '44'
end
end
diff --git a/test/integration/routing/versions_test.rb b/test/integration/routing/versions_test.rb
index 865bd3bb3..172e8cd56 100644
--- a/test/integration/routing/versions_test.rb
+++ b/test/integration/routing/versions_test.rb
@@ -17,53 +17,20 @@
require File.expand_path('../../../test_helper', __FILE__)
-class RoutingVersionsTest < ActionDispatch::IntegrationTest
- def test_roadmap
- # /projects/foo/versions is /projects/foo/roadmap
- assert_routing(
- { :method => 'get', :path => "/projects/33/roadmap" },
- { :controller => 'versions', :action => 'index', :project_id => '33' }
- )
- end
-
- def test_versions_scoped_under_project
- assert_routing(
- { :method => 'put', :path => "/projects/foo/versions/close_completed" },
- { :controller => 'versions', :action => 'close_completed',
- :project_id => 'foo' }
- )
- 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' }
- )
+class RoutingVersionsTest < Redmine::RoutingTest
+ def test_project_versions
+ should_route 'GET /projects/foo/roadmap' => 'versions#index', :project_id => 'foo'
+ should_route 'GET /projects/foo/versions/new' => 'versions#new', :project_id => 'foo'
+ should_route 'POST /projects/foo/versions' => 'versions#create', :project_id => 'foo'
+ should_route 'PUT /projects/foo/versions/close_completed' => 'versions#close_completed', :project_id => 'foo'
end
def test_versions
- assert_routing(
- { :method => 'get', :path => "/versions/1" },
- { :controller => 'versions', :action => 'show', :id => '1' }
- )
- 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 => 'delete', :path => "/versions/1" },
- { :controller => 'versions', :action => 'destroy', :id => '1' }
- )
- assert_routing(
- { :method => 'post', :path => "/versions/1/status_by" },
- { :controller => 'versions', :action => 'status_by', :id => '1' }
- )
+ should_route 'GET /versions/1' => 'versions#show', :id => '1'
+ should_route 'GET /versions/1/edit' => 'versions#edit', :id => '1'
+ should_route 'PUT /versions/1' => 'versions#update', :id => '1'
+ should_route 'DELETE /versions/1' => 'versions#destroy', :id => '1'
+
+ should_route 'POST /versions/1/status_by' => 'versions#status_by', :id => '1'
end
end
diff --git a/test/integration/routing/watchers_test.rb b/test/integration/routing/watchers_test.rb
index f2f9fcb3e..3ab9cdd37 100644
--- a/test/integration/routing/watchers_test.rb
+++ b/test/integration/routing/watchers_test.rb
@@ -17,35 +17,15 @@
require File.expand_path('../../../test_helper', __FILE__)
-class RoutingWatchersTest < ActionDispatch::IntegrationTest
+class RoutingWatchersTest < Redmine::RoutingTest
def test_watchers
- assert_routing(
- { :method => 'get', :path => "/watchers/new" },
- { :controller => 'watchers', :action => 'new' }
- )
- assert_routing(
- { :method => 'post', :path => "/watchers/append" },
- { :controller => 'watchers', :action => 'append' }
- )
- assert_routing(
- { :method => 'post', :path => "/watchers" },
- { :controller => 'watchers', :action => 'create' }
- )
- assert_routing(
- { :method => 'delete', :path => "/watchers" },
- { :controller => 'watchers', :action => 'destroy' }
- )
- assert_routing(
- { :method => 'get', :path => "/watchers/autocomplete_for_user" },
- { :controller => 'watchers', :action => 'autocomplete_for_user' }
- )
- assert_routing(
- { :method => 'post', :path => "/watchers/watch" },
- { :controller => 'watchers', :action => 'watch' }
- )
- assert_routing(
- { :method => 'delete', :path => "/watchers/watch" },
- { :controller => 'watchers', :action => 'unwatch' }
- )
+ should_route 'GET /watchers/new' => 'watchers#new'
+ should_route 'POST /watchers/append' => 'watchers#append'
+ should_route 'POST /watchers' => 'watchers#create'
+ should_route 'DELETE /watchers' => 'watchers#destroy'
+ should_route 'GET /watchers/autocomplete_for_user' => 'watchers#autocomplete_for_user'
+
+ should_route 'POST /watchers/watch' => 'watchers#watch'
+ should_route 'DELETE /watchers/watch' => 'watchers#unwatch'
end
end
diff --git a/test/integration/routing/welcome_test.rb b/test/integration/routing/welcome_test.rb
index 2c2a32213..01a1b61b9 100644
--- a/test/integration/routing/welcome_test.rb
+++ b/test/integration/routing/welcome_test.rb
@@ -17,15 +17,9 @@
require File.expand_path('../../../test_helper', __FILE__)
-class RoutingWelcomeTest < ActionDispatch::IntegrationTest
+class RoutingWelcomeTest < Redmine::RoutingTest
def test_welcome
- assert_routing(
- { :method => 'get', :path => "/" },
- { :controller => 'welcome', :action => 'index' }
- )
- assert_routing(
- { :method => 'get', :path => "/robots.txt" },
- { :controller => 'welcome', :action => 'robots' }
- )
+ should_route 'GET /' => 'welcome#index'
+ should_route 'GET /robots.txt' => 'welcome#robots'
end
end
diff --git a/test/integration/routing/wiki_test.rb b/test/integration/routing/wiki_test.rb
index 09e852497..ef38795bc 100644
--- a/test/integration/routing/wiki_test.rb
+++ b/test/integration/routing/wiki_test.rb
@@ -17,119 +17,43 @@
require File.expand_path('../../../test_helper', __FILE__)
-class RoutingWikiTest < ActionDispatch::IntegrationTest
- def test_wiki_matching
- assert_routing(
- { :method => 'get', :path => "/projects/567/wiki" },
- { :controller => 'wiki', :action => 'show', :project_id => '567' }
- )
- assert_routing(
- { :method => 'get', :path => "/projects/567/wiki/lalala" },
- { :controller => 'wiki', :action => 'show', :project_id => '567',
- :id => 'lalala' }
- )
- assert_routing(
- { :method => 'get', :path => "/projects/567/wiki/lalala.pdf" },
- { :controller => 'wiki', :action => 'show', :project_id => '567',
- :id => 'lalala', :format => 'pdf' }
- )
- assert_routing(
- { :method => 'get', :path => "/projects/1/wiki/CookBook_documentation/diff" },
- { :controller => 'wiki', :action => 'diff', :project_id => '1',
- :id => 'CookBook_documentation' }
- )
- assert_routing(
- { :method => 'get', :path => "/projects/1/wiki/CookBook_documentation/2" },
- { :controller => 'wiki', :action => 'show', :project_id => '1',
- :id => 'CookBook_documentation', :version => '2' }
- )
- assert_routing(
- { :method => 'get', :path => "/projects/1/wiki/CookBook_documentation/2/diff" },
- { :controller => 'wiki', :action => 'diff', :project_id => '1',
- :id => 'CookBook_documentation', :version => '2' }
- )
- assert_routing(
- { :method => 'get', :path => "/projects/1/wiki/CookBook_documentation/2/annotate" },
- { :controller => 'wiki', :action => 'annotate', :project_id => '1',
- :id => 'CookBook_documentation', :version => '2' }
- )
+class RoutingWikiTest < Redmine::RoutingTest
+ def test_wiki
+ should_route 'GET /projects/foo/wiki' => 'wiki#show', :project_id => 'foo'
+ should_route 'GET /projects/foo/wiki/index' => 'wiki#index', :project_id => 'foo'
+ should_route 'GET /projects/foo/wiki/date_index' => 'wiki#date_index', :project_id => 'foo'
+ should_route 'GET /projects/foo/wiki/export' => 'wiki#export', :project_id => 'foo'
+ should_route 'GET /projects/foo/wiki/export.pdf' => 'wiki#export', :project_id => 'foo', :format => 'pdf'
+ end
+
+ def test_wiki_pages
+ should_route 'GET /projects/foo/wiki/page' => 'wiki#show', :project_id => 'foo', :id => 'page'
+ should_route 'GET /projects/foo/wiki/page.pdf' => 'wiki#show', :project_id => 'foo', :id => 'page', :format => 'pdf'
+
+ should_route 'GET /projects/foo/wiki/page/edit' => 'wiki#edit', :project_id => 'foo', :id => 'page'
+ should_route 'PUT /projects/foo/wiki/page' => 'wiki#update', :project_id => 'foo', :id => 'page'
+ should_route 'DELETE /projects/foo/wiki/page' => 'wiki#destroy', :project_id => 'foo', :id => 'page'
+
+ should_route 'GET /projects/foo/wiki/page/history' => 'wiki#history', :project_id => 'foo', :id => 'page'
+ should_route 'GET /projects/foo/wiki/page/diff' => 'wiki#diff', :project_id => 'foo', :id => 'page'
+ should_route 'GET /projects/foo/wiki/page/rename' => 'wiki#rename', :project_id => 'foo', :id => 'page'
+ should_route 'POST /projects/foo/wiki/page/rename' => 'wiki#rename', :project_id => 'foo', :id => 'page'
+ should_route 'POST /projects/foo/wiki/page/protect' => 'wiki#protect', :project_id => 'foo', :id => 'page'
+ should_route 'POST /projects/foo/wiki/page/add_attachment' => 'wiki#add_attachment', :project_id => 'foo', :id => 'page'
+
+ should_route 'POST /projects/foo/wiki/page/preview' => 'wiki#preview', :project_id => 'foo', :id => 'page'
+ should_route 'PUT /projects/foo/wiki/page/preview' => 'wiki#preview', :project_id => 'foo', :id => 'page'
+
# Make sure we don't route wiki page sub-uris to let plugins handle them
assert_raise(Minitest::Assertion) do
- assert_recognizes({}, {:method => 'get', :path => "/projects/1/wiki/CookBook_documentation/whatever"})
+ assert_recognizes({}, {:method => 'get', :path => "/projects/foo/wiki/page/whatever"})
end
end
- def test_wiki_misc
- assert_routing(
- { :method => 'get', :path => "/projects/567/wiki/date_index" },
- { :controller => 'wiki', :action => 'date_index', :project_id => '567' }
- )
- assert_routing(
- { :method => 'get', :path => "/projects/567/wiki/export" },
- { :controller => 'wiki', :action => 'export', :project_id => '567' }
- )
- assert_routing(
- { :method => 'get', :path => "/projects/567/wiki/export.pdf" },
- { :controller => 'wiki', :action => 'export', :project_id => '567', :format => 'pdf' }
- )
- assert_routing(
- { :method => 'get', :path => "/projects/567/wiki/index" },
- { :controller => 'wiki', :action => 'index', :project_id => '567' }
- )
- end
-
- def test_wiki_resources
- assert_routing(
- { :method => 'get', :path => "/projects/567/wiki/my_page/edit" },
- { :controller => 'wiki', :action => 'edit', :project_id => '567',
- :id => 'my_page' }
- )
- assert_routing(
- { :method => 'get', :path => "/projects/1/wiki/CookBook_documentation/history" },
- { :controller => 'wiki', :action => 'history', :project_id => '1',
- :id => 'CookBook_documentation' }
- )
- assert_routing(
- { :method => 'get', :path => "/projects/22/wiki/ladida/rename" },
- { :controller => 'wiki', :action => 'rename', :project_id => '22',
- :id => 'ladida' }
- )
- ["post", "put"].each do |method|
- assert_routing(
- { :method => method, :path => "/projects/567/wiki/CookBook_documentation/preview" },
- { :controller => 'wiki', :action => 'preview', :project_id => '567',
- :id => 'CookBook_documentation' }
- )
- end
- assert_routing(
- { :method => 'post', :path => "/projects/22/wiki/ladida/rename" },
- { :controller => 'wiki', :action => 'rename', :project_id => '22',
- :id => 'ladida' }
- )
- assert_routing(
- { :method => 'post', :path => "/projects/22/wiki/ladida/protect" },
- { :controller => 'wiki', :action => 'protect', :project_id => '22',
- :id => 'ladida' }
- )
- assert_routing(
- { :method => 'post', :path => "/projects/22/wiki/ladida/add_attachment" },
- { :controller => 'wiki', :action => 'add_attachment', :project_id => '22',
- :id => 'ladida' }
- )
- assert_routing(
- { :method => 'put', :path => "/projects/567/wiki/my_page" },
- { :controller => 'wiki', :action => 'update', :project_id => '567',
- :id => 'my_page' }
- )
- assert_routing(
- { :method => 'delete', :path => "/projects/22/wiki/ladida" },
- { :controller => 'wiki', :action => 'destroy', :project_id => '22',
- :id => 'ladida' }
- )
- assert_routing(
- { :method => 'delete', :path => "/projects/22/wiki/ladida/3" },
- { :controller => 'wiki', :action => 'destroy_version', :project_id => '22',
- :id => 'ladida', :version => '3' }
- )
+ def test_wiki_page_versions
+ should_route 'GET /projects/foo/wiki/page/2' => 'wiki#show', :project_id => 'foo', :id => 'page', :version => '2'
+ should_route 'GET /projects/foo/wiki/page/2/diff' => 'wiki#diff', :project_id => 'foo', :id => 'page', :version => '2'
+ should_route 'GET /projects/foo/wiki/page/2/annotate' => 'wiki#annotate', :project_id => 'foo', :id => 'page', :version => '2'
+ should_route 'DELETE /projects/foo/wiki/page/2' => 'wiki#destroy_version', :project_id => 'foo', :id => 'page', :version => '2'
end
end
diff --git a/test/integration/routing/wikis_test.rb b/test/integration/routing/wikis_test.rb
index 98c83d0a0..be2eed50b 100644
--- a/test/integration/routing/wikis_test.rb
+++ b/test/integration/routing/wikis_test.rb
@@ -17,17 +17,11 @@
require File.expand_path('../../../test_helper', __FILE__)
-class RoutingWikisTest < ActionDispatch::IntegrationTest
- def test_wikis_plural_admin_setup
- ["get", "post"].each do |method|
- assert_routing(
- { :method => method, :path => "/projects/ladida/wiki/destroy" },
- { :controller => 'wikis', :action => 'destroy', :id => 'ladida' }
- )
- end
- assert_routing(
- { :method => 'post', :path => "/projects/ladida/wiki" },
- { :controller => 'wikis', :action => 'edit', :id => 'ladida' }
- )
+class RoutingWikisTest < Redmine::RoutingTest
+ def test_wikis
+ should_route 'POST /projects/foo/wiki' => 'wikis#edit', :id => 'foo'
+
+ should_route 'GET /projects/foo/wiki/destroy' => 'wikis#destroy', :id => 'foo'
+ should_route 'POST /projects/foo/wiki/destroy' => 'wikis#destroy', :id => 'foo'
end
end
diff --git a/test/integration/routing/workflows_test.rb b/test/integration/routing/workflows_test.rb
index 828b827e9..43d768d46 100644
--- a/test/integration/routing/workflows_test.rb
+++ b/test/integration/routing/workflows_test.rb
@@ -17,29 +17,16 @@
require File.expand_path('../../../test_helper', __FILE__)
-class RoutingWorkflowsTest < ActionDispatch::IntegrationTest
+class RoutingWorkflowsTest < Redmine::RoutingTest
def test_workflows
- assert_routing(
- { :method => 'get', :path => "/workflows" },
- { :controller => 'workflows', :action => 'index' }
- )
- ["get", "post"].each do |method|
- assert_routing(
- { :method => method, :path => "/workflows/edit" },
- { :controller => 'workflows', :action => 'edit' }
- )
- end
- ["get", "post"].each do |method|
- assert_routing(
- { :method => method, :path => "/workflows/permissions" },
- { :controller => 'workflows', :action => 'permissions' }
- )
- end
- ["get", "post"].each do |method|
- assert_routing(
- { :method => method, :path => "/workflows/copy" },
- { :controller => 'workflows', :action => 'copy' }
- )
- end
+ should_route 'GET /workflows' => 'workflows#index'
+ should_route 'GET /workflows/edit' => 'workflows#edit'
+ should_route 'POST /workflows/edit' => 'workflows#edit'
+
+ should_route 'GET /workflows/permissions' => 'workflows#permissions'
+ should_route 'POST /workflows/permissions' => 'workflows#permissions'
+
+ should_route 'GET /workflows/copy' => 'workflows#copy'
+ should_route 'POST /workflows/copy' => 'workflows#copy'
end
end