Sort the issue list by author/assignee according to user display format (#9669).

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@7938 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang
2011-11-26 17:37:20 +00:00
parent 0293ba7e9f
commit 5a1fcf826f
6 changed files with 107 additions and 18 deletions
+24
View File
@@ -397,6 +397,30 @@ class UserTest < ActiveSupport::TestCase
Setting.user_format = :username
assert_equal 'jsmith', @jsmith.reload.name
end
def test_fields_for_order_statement_should_return_fields_according_user_format_setting
with_settings :user_format => 'lastname_coma_firstname' do
assert_equal ['users.lastname', 'users.firstname', 'users.id'], User.fields_for_order_statement
end
end
def test_fields_for_order_statement_width_table_name_should_prepend_table_name
with_settings :user_format => 'lastname_firstname' do
assert_equal ['authors.lastname', 'authors.firstname', 'authors.id'], User.fields_for_order_statement('authors')
end
end
def test_fields_for_order_statement_with_blank_format_should_return_default
with_settings :user_format => '' do
assert_equal ['users.firstname', 'users.lastname', 'users.id'], User.fields_for_order_statement
end
end
def test_fields_for_order_statement_with_invalid_format_should_return_default
with_settings :user_format => 'foo' do
assert_equal ['users.firstname', 'users.lastname', 'users.id'], User.fields_for_order_statement
end
end
def test_lock
user = User.try_to_login("jsmith", "jsmith")