Merged r19486 to 19488 to 4.0-stable (#32850).

git-svn-id: http://svn.redmine.org/redmine/branches/4.0-stable@19648 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang
2020-04-05 08:06:14 +00:00
parent edc307d998
commit 37d5ad72a6
5 changed files with 54 additions and 23 deletions

View File

@@ -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

View File

@@ -138,6 +138,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