diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2020-04-05 08:04:27 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2020-04-05 08:04:27 +0000 |
commit | 882d87327b41577ec4e0aa10435237cb691ffc39 (patch) | |
tree | a761771410051732d7ceb12d3ef7716736df9428 /test/functional | |
parent | 06e538861a2dd176d29faa24dd630d1dbc38d2e3 (diff) | |
download | redmine-882d87327b41577ec4e0aa10435237cb691ffc39.tar.gz redmine-882d87327b41577ec4e0aa10435237cb691ffc39.zip |
Merged r19486 to 19488 to 4.1-stable (#32850).
git-svn-id: http://svn.redmine.org/redmine/branches/4.1-stable@19647 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/functional')
-rw-r--r-- | test/functional/application_controller_test.rb | 27 | ||||
-rw-r--r-- | test/functional/timelog_controller_test.rb | 13 |
2 files changed, 40 insertions, 0 deletions
diff --git a/test/functional/application_controller_test.rb b/test/functional/application_controller_test.rb new file mode 100644 index 000000000..abaa4a23e --- /dev/null +++ b/test/functional/application_controller_test.rb @@ -0,0 +1,27 @@ +# frozen_string_literal: true + +# Redmine - project management software +# Copyright (C) 2006-2020 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 ApplicationControllerTest < Redmine::ControllerTest + def test_back_url_should_remove_utf8_checkmark_from_referer + @request.set_header 'HTTP_REFERER', "/path?utf8=\u2713&foo=bar" + assert_equal "/path?foo=bar", @controller.back_url + end +end diff --git a/test/functional/timelog_controller_test.rb b/test/functional/timelog_controller_test.rb index 2dd0d9e00..360ea14b1 100644 --- a/test/functional/timelog_controller_test.rb +++ b/test/functional/timelog_controller_test.rb @@ -173,6 +173,19 @@ class TimelogControllerTest < Redmine::ControllerTest assert_select 'select[name=?]', 'time_entry[project_id]' end + def test_get_edit_should_validate_back_url + @request.session[:user_id] = 2 + + get :edit, :params => {:id => 2, :project_id => nil, :back_url => '/valid'} + assert_response :success + assert_select 'a[href=?]', '/valid', {:text => 'Cancel'} + + get :edit, :params => {:id => 2, :project_id => nil, :back_url => 'invalid'} + assert_response :success + assert_select 'a[href=?]', 'invalid', {:text => 'Cancel', :count => 0} + assert_select 'a[href=?]', '/projects/ecookbook/time_entries', {:text => 'Cancel'} + end + def test_post_create @request.session[:user_id] = 3 assert_difference 'TimeEntry.count' do |