From c0800b330c858edbb961e71e54771ad30f9fee7b Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Sun, 21 Dec 2014 20:15:24 +0000 Subject: 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 --- test/integration/api_test/groups_test.rb | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'test') 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') -- cgit v1.2.3