diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2011-07-23 19:05:22 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2011-07-23 19:05:22 +0000 |
commit | ed01ae121daf44d1df43332b01f3d5f9d627a3d5 (patch) | |
tree | 4f20b0b772bc5b6a9ee354d9a084fc9ea07559f6 /test | |
parent | 578fdc62f26c23951b2d2c2b9be0040c7ade0634 (diff) | |
download | redmine-ed01ae121daf44d1df43332b01f3d5f9d627a3d5.tar.gz redmine-ed01ae121daf44d1df43332b01f3d5f9d627a3d5.zip |
Adds a optgroup for groups in users/groups select tags.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@6307 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test')
-rw-r--r-- | test/unit/helpers/application_helper_test.rb | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/test/unit/helpers/application_helper_test.rb b/test/unit/helpers/application_helper_test.rb index 1d82dcb0e..d2e7cee62 100644 --- a/test/unit/helpers/application_helper_test.rb +++ b/test/unit/helpers/application_helper_test.rb @@ -675,4 +675,27 @@ RAW assert_equal %(<a href="/projects/ecookbook/settings" class="project">eCookbook</a>), link_to_project(project, {:action => 'settings'}, :class => "project") end + + def test_principals_options_for_select_with_users + users = [User.find(2), User.find(4)] + assert_equal %(<option value="2">John Smith</option><option value="4">Robert Hill</option>), + principals_options_for_select(users) + end + + def test_principals_options_for_select_with_selected + users = [User.find(2), User.find(4)] + assert_equal %(<option value="2">John Smith</option><option value="4" selected="selected">Robert Hill</option>), + principals_options_for_select(users, User.find(4)) + end + + def test_principals_options_for_select_with_users_and_groups + users = [User.find(2), Group.find(11), User.find(4), Group.find(10)] + assert_equal %(<option value="2">John Smith</option><option value="4">Robert Hill</option>) + + %(<optgroup label="Groups"><option value="10">A Team</option><option value="11">B Team</option></optgroup>), + principals_options_for_select(users) + end + + def test_principals_options_for_select_with_empty_collection + assert_equal '', principals_options_for_select([]) + end end |