diff options
author | Stan Hu <stanhu@gmail.com> | 2019-05-08 08:50:43 +0300 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2019-05-10 08:35:40 +0300 |
commit | f16406167e107aa23489469daee98bc842675e06 (patch) | |
tree | 65b60b89463b59988d0493b510e45cb8e7a60df7 /spec/services/members | |
parent | 712dccd4c0f37b9fce12f5a945a551f8dca07cc4 (diff) |
Fix Error 500 when inviting user already present
A project admin attempting to invite an already-invited user
will see a confusing Error 500 message.
Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/61574
Diffstat (limited to 'spec/services/members')
-rw-r--r-- | spec/services/members/create_service_spec.rb | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/spec/services/members/create_service_spec.rb b/spec/services/members/create_service_spec.rb index 2c4fb131ed9..674fe0f666e 100644 --- a/spec/services/members/create_service_spec.rb +++ b/spec/services/members/create_service_spec.rb @@ -44,7 +44,18 @@ describe Members::CreateService do result = described_class.new(user, params).execute(project) expect(result[:status]).to eq(:error) - expect(result[:message]).to include(project_user.username) + expect(result[:message]).to include("#{project_user.username}: Access level is not included in the list") expect(project.users).not_to include project_user end + + it 'does not add a member with an existing invite' do + invited_member = create(:project_member, :invited, project: project) + + params = { user_ids: invited_member.invite_email, + access_level: Gitlab::Access::GUEST } + result = described_class.new(user, params).execute(project) + + expect(result[:status]).to eq(:error) + expect(result[:message]).to eq('Invite email has already been taken') + end end |