diff options
author | Nick Thomas <nick@gitlab.com> | 2017-06-06 17:55:12 +0300 |
---|---|---|
committer | Nick Thomas <nick@gitlab.com> | 2017-06-06 18:04:26 +0300 |
commit | 5c602e306cdf979a70aaa81cd473f491f2eee45a (patch) | |
tree | e1c1d5490f74b9ae44ecb8b91712c7b54c139ec7 /spec/services/members | |
parent | 2f02843fe9fbcbef09ef8f122e9a84d809f2c29a (diff) |
Limit non-administrators to adding 100 members at a time to groups and projects
Diffstat (limited to 'spec/services/members')
-rw-r--r-- | spec/services/members/create_service_spec.rb | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/spec/services/members/create_service_spec.rb b/spec/services/members/create_service_spec.rb index 0670ac2faa2..5ce8e17976b 100644 --- a/spec/services/members/create_service_spec.rb +++ b/spec/services/members/create_service_spec.rb @@ -11,7 +11,7 @@ describe Members::CreateService, services: true do params = { user_ids: project_user.id.to_s, access_level: Gitlab::Access::GUEST } result = described_class.new(project, user, params).execute - expect(result).to be_truthy + expect(result[:status]).to eq(:success) expect(project.users).to include project_user end @@ -19,7 +19,19 @@ describe Members::CreateService, services: true do params = { user_ids: '', access_level: Gitlab::Access::GUEST } result = described_class.new(project, user, params).execute - expect(result).to be_falsey + expect(result[:status]).to eq(:error) + expect(result[:message]).to be_present + expect(project.users).not_to include project_user + end + + it 'limits the number of users to 100' do + user_ids = 1.upto(101).to_a.join(',') + params = { user_ids: user_ids, access_level: Gitlab::Access::GUEST } + + result = described_class.new(project, user, params).execute + + expect(result[:status]).to eq(:error) + expect(result[:message]).to be_present expect(project.users).not_to include project_user end end |