Fixes ApplicationHelper#link_to_user

* No link to a locked user page (closes #4182)
* Translate Anonymous string

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@3024 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang
2009-11-11 10:48:54 +00:00
parent 8f40750ad7
commit c31411ec00
39 changed files with 65 additions and 5 deletions

View File

@@ -83,7 +83,7 @@ users_005:
users_006:
id: 6
created_on: 2006-07-19 19:33:19 +02:00
status: 1
status: 0
last_login_on:
language: ''
hashed_password: 1

View File

@@ -483,4 +483,24 @@ EXPECTED
Setting.gravatar_enabled = '0'
assert_nil avatar(User.find_by_mail('jsmith@somenet.foo'))
end
def test_link_to_user
user = User.find(2)
t = link_to_user(user)
assert_equal "<a href=\"/users/2\">#{ user.name }</a>", t
end
def test_link_to_user_should_not_link_to_locked_user
user = User.find(5)
assert user.locked?
t = link_to_user(user)
assert_equal user.name, t
end
def test_link_to_user_should_not_link_to_anonymous
user = User.anonymous
assert user.anonymous?
t = link_to_user(user)
assert_equal ::I18n.t(:label_user_anonymous), t
end
end