You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

routes_helper_test.rb 2.2KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. # frozen_string_literal: true
  2. # Redmine - project management software
  3. # Copyright (C) 2006-2022 Jean-Philippe Lang
  4. #
  5. # This program is free software; you can redistribute it and/or
  6. # modify it under the terms of the GNU General Public License
  7. # as published by the Free Software Foundation; either version 2
  8. # of the License, or (at your option) any later version.
  9. #
  10. # This program is distributed in the hope that it will be useful,
  11. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. # GNU General Public License for more details.
  14. #
  15. # You should have received a copy of the GNU General Public License
  16. # along with this program; if not, write to the Free Software
  17. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  18. require File.expand_path('../../test_helper', __FILE__)
  19. class RoutesHelperTest < Redmine::HelperTest
  20. fixtures :projects, :issues
  21. include Rails.application.routes.url_helpers
  22. def test_time_entries_path
  23. assert_equal '/projects/ecookbook/time_entries', _time_entries_path(Project.find(1), nil)
  24. assert_equal '/time_entries', _time_entries_path(nil, nil)
  25. end
  26. def test_report_time_entries_path
  27. assert_equal '/projects/ecookbook/time_entries/report', _report_time_entries_path(Project.find(1), nil)
  28. assert_equal '/time_entries/report', _report_time_entries_path(nil, nil)
  29. end
  30. def test_new_time_entry_path
  31. assert_equal '/projects/ecookbook/time_entries/new', _new_time_entry_path(Project.find(1), nil)
  32. assert_equal '/issues/1/time_entries/new', _new_time_entry_path(Project.find(1), Issue.find(1))
  33. assert_equal '/issues/1/time_entries/new', _new_time_entry_path(nil, Issue.find(1))
  34. assert_equal '/time_entries/new', _new_time_entry_path(nil, nil)
  35. end
  36. def test_project_issues_url
  37. assert_equal 'http://test.host/projects/ecookbook/issues', _project_issues_url(Project.find(1))
  38. assert_equal 'http://test.host/issues', _project_issues_url(nil)
  39. assert_equal 'http://test.host/projects/ecookbook/issues?set_filter=1', _project_issues_url(Project.find(1), set_filter: 1)
  40. assert_equal 'http://test.host/issues?set_filter=1', _project_issues_url(nil, set_filter: 1)
  41. end
  42. end