summaryrefslogtreecommitdiffstats
path: root/test/unit/user_test.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2011-11-26 17:37:20 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2011-11-26 17:37:20 +0000
commit5a1fcf826ffe4c4d6e0f839138d442725cae2ab5 (patch)
tree82b6f8d8f638d2798315cc82abd352c77c45cd28 /test/unit/user_test.rb
parent0293ba7e9f4f82788363ef699327887005db7b3e (diff)
downloadredmine-5a1fcf826ffe4c4d6e0f839138d442725cae2ab5.tar.gz
redmine-5a1fcf826ffe4c4d6e0f839138d442725cae2ab5.zip
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
Diffstat (limited to 'test/unit/user_test.rb')
-rw-r--r--test/unit/user_test.rb24
1 files changed, 24 insertions, 0 deletions
diff --git a/test/unit/user_test.rb b/test/unit/user_test.rb
index 5f7150d6e..a772d0079 100644
--- a/test/unit/user_test.rb
+++ b/test/unit/user_test.rb
@@ -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")