From bc7ed1e156788bc5c823c8aa22f0d8153f5730e8 Mon Sep 17 00:00:00 2001 From: Toshi MARUYAMA Date: Sat, 24 Dec 2011 04:13:38 +0000 Subject: [PATCH] test: route: move timelogs tests to new file git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@8343 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- test/integration/routing/timelog_test.rb | 203 +++++++++++++++++++++++ test/integration/routing_test.rb | 183 -------------------- 2 files changed, 203 insertions(+), 183 deletions(-) create mode 100644 test/integration/routing/timelog_test.rb diff --git a/test/integration/routing/timelog_test.rb b/test/integration/routing/timelog_test.rb new file mode 100644 index 000000000..b5ce892e9 --- /dev/null +++ b/test/integration/routing/timelog_test.rb @@ -0,0 +1,203 @@ +# Redmine - project management software +# Copyright (C) 2006-2011 Jean-Philippe Lang +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +require File.expand_path('../../../test_helper', __FILE__) + +class RoutingTimelogsTest < ActionController::IntegrationTest + 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' } + ) + 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' } + ) + 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' } + ) + end + + def test_timelogs_scoped_under_project_and_issues + assert_routing( + { :method => 'get', + :path => "/projects/ecookbook/issues/234/time_entries" }, + { :controller => 'timelog', :action => 'index', + :issue_id => '234', :project_id => 'ecookbook' } + ) + assert_routing( + { :method => 'get', + :path => "/projects/ecookbook/issues/234/time_entries.csv" }, + { :controller => 'timelog', :action => 'index', + :issue_id => '234', :project_id => 'ecookbook', :format => 'csv' } + ) + assert_routing( + { :method => 'get', + :path => "/projects/ecookbook/issues/234/time_entries.atom" }, + { :controller => 'timelog', :action => 'index', + :issue_id => '234', :project_id => 'ecookbook', :format => 'atom' } + ) + assert_routing( + { :method => 'get', + :path => "/projects/ecookbook/issues/234/time_entries/new" }, + { :controller => 'timelog', :action => 'new', + :issue_id => '234', :project_id => 'ecookbook' } + ) + assert_routing( + { :method => 'get', + :path => "/projects/ecookbook/issues/234/time_entries/22/edit" }, + { :controller => 'timelog', :action => 'edit', :id => '22', + :issue_id => '234', :project_id => 'ecookbook' } + ) + assert_routing( + { :method => 'post', + :path => "/projects/ecookbook/issues/234/time_entries" }, + { :controller => 'timelog', :action => 'create', + :issue_id => '234', :project_id => 'ecookbook' } + ) + assert_routing( + { :method => 'put', + :path => "/projects/ecookbook/issues/234/time_entries/22" }, + { :controller => 'timelog', :action => 'update', :id => '22', + :issue_id => '234', :project_id => 'ecookbook' } + ) + assert_routing( + { :method => 'delete', + :path => "/projects/ecookbook/issues/234/time_entries/55" }, + { :controller => 'timelog', :action => 'destroy', :id => '55', + :issue_id => '234', :project_id => 'ecookbook' } + ) + assert_routing( + { :method => 'get', + :path => "/time_entries/report" }, + { :controller => 'timelog', :action => 'report' } + ) + 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' } + ) + end +end diff --git a/test/integration/routing_test.rb b/test/integration/routing_test.rb index afe0d75db..82be3b451 100644 --- a/test/integration/routing_test.rb +++ b/test/integration/routing_test.rb @@ -475,189 +475,6 @@ class RoutingTest < ActionController::IntegrationTest ) end - 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' } - ) - 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' } - ) - 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' } - ) - end - - def test_timelogs_scoped_under_project_and_issues - assert_routing( - { :method => 'get', - :path => "/projects/ecookbook/issues/234/time_entries" }, - { :controller => 'timelog', :action => 'index', - :issue_id => '234', :project_id => 'ecookbook' } - ) - assert_routing( - { :method => 'get', - :path => "/projects/ecookbook/issues/234/time_entries.csv" }, - { :controller => 'timelog', :action => 'index', - :issue_id => '234', :project_id => 'ecookbook', :format => 'csv' } - ) - assert_routing( - { :method => 'get', - :path => "/projects/ecookbook/issues/234/time_entries.atom" }, - { :controller => 'timelog', :action => 'index', - :issue_id => '234', :project_id => 'ecookbook', :format => 'atom' } - ) - assert_routing( - { :method => 'get', - :path => "/projects/ecookbook/issues/234/time_entries/new" }, - { :controller => 'timelog', :action => 'new', - :issue_id => '234', :project_id => 'ecookbook' } - ) - assert_routing( - { :method => 'get', - :path => "/projects/ecookbook/issues/234/time_entries/22/edit" }, - { :controller => 'timelog', :action => 'edit', :id => '22', - :issue_id => '234', :project_id => 'ecookbook' } - ) - assert_routing( - { :method => 'post', - :path => "/projects/ecookbook/issues/234/time_entries" }, - { :controller => 'timelog', :action => 'create', - :issue_id => '234', :project_id => 'ecookbook' } - ) - assert_routing( - { :method => 'put', - :path => "/projects/ecookbook/issues/234/time_entries/22" }, - { :controller => 'timelog', :action => 'update', :id => '22', - :issue_id => '234', :project_id => 'ecookbook' } - ) - assert_routing( - { :method => 'delete', - :path => "/projects/ecookbook/issues/234/time_entries/55" }, - { :controller => 'timelog', :action => 'destroy', :id => '55', - :issue_id => '234', :project_id => 'ecookbook' } - ) - assert_routing( - { :method => 'get', - :path => "/time_entries/report" }, - { :controller => 'timelog', :action => 'report' } - ) - 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' } - ) - end - def test_users assert_routing( { :method => 'get', :path => "/users" },