summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2014-10-04 09:14:17 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2014-10-04 09:14:17 +0000
commit2e9b28906db62f5ef5b2663f68d395a8e261959c (patch)
tree056539161b4f990d59dcb3482ae7c8b172b4417d /test
parentefdf2584b68bfde062507965811f0f416f42dcbc (diff)
downloadredmine-2e9b28906db62f5ef5b2663f68d395a8e261959c.tar.gz
redmine-2e9b28906db62f5ef5b2663f68d395a8e261959c.zip
Removes routes for time entries nested under project/issues.
git-svn-id: http://svn.redmine.org/redmine/trunk@13424 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test')
-rw-r--r--test/functional/time_entry_reports_controller_test.rb4
-rw-r--r--test/functional/timelog_controller_test.rb6
-rw-r--r--test/integration/routing/timelog_test.rb51
-rw-r--r--test/unit/helpers/routes_helper_test.rb45
4 files changed, 50 insertions, 56 deletions
diff --git a/test/functional/time_entry_reports_controller_test.rb b/test/functional/time_entry_reports_controller_test.rb
index 56e23f935..bbc4d3c1d 100644
--- a/test/functional/time_entry_reports_controller_test.rb
+++ b/test/functional/time_entry_reports_controller_test.rb
@@ -130,13 +130,13 @@ class TimeEntryReportsControllerTest < ActionController::TestCase
end
def test_report_at_issue_level
- get :report, :project_id => 1, :issue_id => 1, :columns => 'month', :from => "2007-01-01", :to => "2007-12-31", :criteria => ["user", "activity"]
+ get :report, :issue_id => 1, :columns => 'month', :from => "2007-01-01", :to => "2007-12-31", :criteria => ["user", "activity"]
assert_response :success
assert_template 'report'
assert_not_nil assigns(:report)
assert_equal "154.25", "%.2f" % assigns(:report).total_hours
assert_tag :form,
- :attributes => {:action => "/projects/ecookbook/issues/1/time_entries/report", :id => 'query_form'}
+ :attributes => {:action => "/issues/1/time_entries/report", :id => 'query_form'}
end
def test_report_by_week_should_use_commercial_year
diff --git a/test/functional/timelog_controller_test.rb b/test/functional/timelog_controller_test.rb
index 4760b288d..cc76cba21 100644
--- a/test/functional/timelog_controller_test.rb
+++ b/test/functional/timelog_controller_test.rb
@@ -581,7 +581,7 @@ class TimelogControllerTest < ActionController::TestCase
assert_nil assigns(:from)
assert_nil assigns(:to)
assert_tag :form,
- :attributes => {:action => "/projects/ecookbook/issues/1/time_entries", :id => 'query_form'}
+ :attributes => {:action => "/issues/1/time_entries", :id => 'query_form'}
end
def test_index_should_sort_by_spent_on_and_created_on
@@ -693,11 +693,11 @@ class TimelogControllerTest < ActionController::TestCase
end
def test_index_at_issue_level_should_include_csv_export_dialog
- get :index, :project_id => 'ecookbook', :issue_id => 3
+ get :index, :issue_id => 3
assert_response :success
assert_select '#csv-export-options' do
- assert_select 'form[action=?][method=get]', '/projects/ecookbook/issues/3/time_entries.csv'
+ assert_select 'form[action=?][method=get]', '/issues/3/time_entries.csv'
end
end
diff --git a/test/integration/routing/timelog_test.rb b/test/integration/routing/timelog_test.rb
index eaba22c3b..96bbfeb39 100644
--- a/test/integration/routing/timelog_test.rb
+++ b/test/integration/routing/timelog_test.rb
@@ -134,57 +134,6 @@ class RoutingTimelogsTest < ActionController::IntegrationTest
)
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' }
- )
- end
-
def test_timelogs_report
assert_routing(
{ :method => 'get',
diff --git a/test/unit/helpers/routes_helper_test.rb b/test/unit/helpers/routes_helper_test.rb
new file mode 100644
index 000000000..f7fb9fbf6
--- /dev/null
+++ b/test/unit/helpers/routes_helper_test.rb
@@ -0,0 +1,45 @@
+# encoding: utf-8
+#
+# Redmine - project management software
+# Copyright (C) 2006-2014 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 RoutesHelperTest < ActionView::TestCase
+ include Rails.application.routes.url_helpers
+
+ def test_time_entries_path
+ assert_equal '/projects/ecookbook/time_entries', _time_entries_path(Project.find(1), nil)
+ assert_equal '/issues/1/time_entries', _time_entries_path(Project.find(1), Issue.find(1))
+ assert_equal '/issues/1/time_entries', _time_entries_path(nil, Issue.find(1))
+ assert_equal '/time_entries', _time_entries_path(nil, nil)
+ end
+
+ def test_report_time_entries_path
+ assert_equal '/projects/ecookbook/time_entries/report', _report_time_entries_path(Project.find(1), nil)
+ assert_equal '/issues/1/time_entries/report', _report_time_entries_path(Project.find(1), Issue.find(1))
+ assert_equal '/issues/1/time_entries/report', _report_time_entries_path(nil, Issue.find(1))
+ assert_equal '/time_entries/report', _report_time_entries_path(nil, nil)
+ end
+
+ def test_new_time_entry_path
+ assert_equal '/projects/ecookbook/time_entries/new', _new_time_entry_path(Project.find(1), nil)
+ assert_equal '/issues/1/time_entries/new', _new_time_entry_path(Project.find(1), Issue.find(1))
+ assert_equal '/issues/1/time_entries/new', _new_time_entry_path(nil, Issue.find(1))
+ assert_equal '/time_entries/new', _new_time_entry_path(nil, nil)
+ end
+end