diff options
author | Go MAEDA <maeda@farend.jp> | 2021-09-07 14:59:40 +0000 |
---|---|---|
committer | Go MAEDA <maeda@farend.jp> | 2021-09-07 14:59:40 +0000 |
commit | bc3938fca31d9a36e4310df1fb80f6c0690b7461 (patch) | |
tree | 2821db056fb74e08a953fedad05fe34710412d1a /test/helpers/application_helper_test.rb | |
parent | 326a1b4dd2e0c877beb1023fa3d6d943bb0275e4 (diff) | |
download | redmine-bc3938fca31d9a36e4310df1fb80f6c0690b7461.tar.gz redmine-bc3938fca31d9a36e4310df1fb80f6c0690b7461.zip |
Fix NoMethodError when generating a link to a locked user (#12795, #35823).
git-svn-id: http://svn.redmine.org/redmine/trunk@21217 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/helpers/application_helper_test.rb')
-rw-r--r-- | test/helpers/application_helper_test.rb | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/test/helpers/application_helper_test.rb b/test/helpers/application_helper_test.rb index 6caafcb89..108b0dfae 100644 --- a/test/helpers/application_helper_test.rb +++ b/test/helpers/application_helper_test.rb @@ -1701,12 +1701,18 @@ class ApplicationHelperTest < Redmine::HelperTest end end - def test_link_to_user_should_link_to_locked_user_if_current_user_is_admin + def test_link_to_user_should_link_to_locked_user_only_if_current_user_is_admin + user = User.find(5) + assert user.locked? + with_current_user User.find(1) do - user = User.find(5) - assert user.locked? - result = link_to("Dave2 Lopper2", "/users/5", :class => "user locked") - assert_equal result, link_to_user(user) + result = link_to('Dave2 Lopper2', '/users/5', :class => 'user locked assigned_to') + assert_equal result, link_to_user(user, :class => 'assigned_to') + end + + with_current_user User.find(2) do + result = 'Dave2 Lopper2' + assert_equal result, link_to_user(user, :class => 'assigned_to') end end @@ -1722,6 +1728,12 @@ class ApplicationHelperTest < Redmine::HelperTest assert_equal result, link_to_principal(group) end + def test_link_to_principal_should_return_string_representation_for_unknown_type_principal + unknown_principal = 'foo' + result = unknown_principal.to_s + assert_equal result, link_to_principal(unknown_principal, :class => 'bar') + end + def test_link_to_group_should_return_only_group_name_for_non_admin_users User.current = nil group = Group.find(10) |