diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2012-06-03 10:40:32 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2012-06-03 10:40:32 +0000 |
commit | dd9c2cafa795ec00875981dcedd3287d2d005457 (patch) | |
tree | 4d540a76dc06fb4d530bb5804d3676fa366489d7 /test/unit/group_test.rb | |
parent | 3142183b3052b520126645eaec01526810e2afff (diff) | |
download | redmine-dd9c2cafa795ec00875981dcedd3287d2d005457.tar.gz redmine-dd9c2cafa795ec00875981dcedd3287d2d005457.zip |
REST Api for Groups (#8981).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@9758 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/unit/group_test.rb')
-rw-r--r-- | test/unit/group_test.rb | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/test/unit/group_test.rb b/test/unit/group_test.rb index 3d7c2da26..8038ba45c 100644 --- a/test/unit/group_test.rb +++ b/test/unit/group_test.rb @@ -53,7 +53,7 @@ class GroupTest < ActiveSupport::TestCase assert_include str, g.errors.full_messages end - def test_roles_given_to_new_user + def test_group_roles_should_be_given_to_added_user group = Group.find(11) user = User.find(9) project = Project.first @@ -63,7 +63,7 @@ class GroupTest < ActiveSupport::TestCase assert user.member_of?(project) end - def test_roles_given_to_existing_user + def test_new_roles_should_be_given_to_existing_user group = Group.find(11) user = User.find(9) project = Project.first @@ -73,7 +73,22 @@ class GroupTest < ActiveSupport::TestCase assert user.member_of?(project) end - def test_roles_updated + def test_user_roles_should_updated_when_updating_user_ids + group = Group.find(11) + user = User.find(9) + project = Project.first + + Member.create!(:principal => group, :project => project, :role_ids => [1, 2]) + group.user_ids = [user.id] + group.save! + assert User.find(9).member_of?(project) + + group.user_ids = [1] + group.save! + assert !User.find(9).member_of?(project) + end + + def test_user_roles_should_updated_when_updating_group_roles group = Group.find(11) user = User.find(9) project = Project.first @@ -91,13 +106,13 @@ class GroupTest < ActiveSupport::TestCase assert_equal [1], user.reload.roles_for_project(project).collect(&:id).sort end - def test_roles_removed_when_removing_group_membership + def test_user_memberships_should_be_removed_when_removing_group_membership assert User.find(8).member_of?(Project.find(5)) Member.find_by_project_id_and_user_id(5, 10).destroy assert !User.find(8).member_of?(Project.find(5)) end - def test_roles_removed_when_removing_user_from_group + def test_user_roles_should_be_removed_when_removing_user_from_group assert User.find(8).member_of?(Project.find(5)) User.find(8).groups.clear assert !User.find(8).member_of?(Project.find(5)) |