diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2014-12-21 20:15:24 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2014-12-21 20:15:24 +0000 |
commit | c0800b330c858edbb961e71e54771ad30f9fee7b (patch) | |
tree | f5b8f2cb3f28c6093dfa7f70509d166f1b87fb48 /test/integration/api_test | |
parent | a3d4b63261c2e54ace2a0de6cda67cba704bf5d9 (diff) | |
download | redmine-c0800b330c858edbb961e71e54771ad30f9fee7b.tar.gz redmine-c0800b330c858edbb961e71e54771ad30f9fee7b.zip |
Error when adding user to group where he is already assigned (#18665).
git-svn-id: http://svn.redmine.org/redmine/trunk@13785 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/integration/api_test')
-rw-r--r-- | test/integration/api_test/groups_test.rb | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/test/integration/api_test/groups_test.rb b/test/integration/api_test/groups_test.rb index 2fe8271b1..087041219 100644 --- a/test/integration/api_test/groups_test.rb +++ b/test/integration/api_test/groups_test.rb @@ -185,6 +185,19 @@ class Redmine::ApiTest::GroupsTest < Redmine::ApiTest::Base assert_include User.find(5), Group.find(10).users end + test "POST /groups/:id/users.xml should not add the user if already added" do + Group.find(10).users << User.find(5) + + assert_no_difference 'Group.find(10).users.count' do + post '/groups/10/users.xml', {:user_id => 5}, credentials('admin') + assert_response :unprocessable_entity + end + + assert_select 'errors' do + assert_select 'error', :text => /User is invalid/ + end + end + test "DELETE /groups/:id/users/:user_id.xml should remove user from the group" do assert_difference 'Group.find(10).users.count', -1 do delete '/groups/10/users/8.xml', {}, credentials('admin') |