summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorRobert Speicher <robert@gitlab.com>2016-09-20 05:20:47 +0000
committerRobert Speicher <robert@gitlab.com>2016-09-20 05:20:47 +0000
commit791079e2abeef1d3ebeecc8157bfb02cfdf9b36d (patch)
treebbcf16a56620c7b1270913c859624fbc19f03ec1 /spec
parent5550bbec106835584f5eb5be3a00fbf1d78585f4 (diff)
parentc054254f1e5038f85e407317e63a7bcb45368125 (diff)
downloadgitlab-ce-791079e2abeef1d3ebeecc8157bfb02cfdf9b36d.tar.gz
Merge branch '22065-group-members-api-returning-null-user-details' into 'master'
Ensure invitees are not returned in Members API ## What are the relevant issue numbers? Closes #22065 See merge request !6370
Diffstat (limited to 'spec')
-rw-r--r--spec/requests/api/members_spec.rb27
1 files changed, 18 insertions, 9 deletions
diff --git a/spec/requests/api/members_spec.rb b/spec/requests/api/members_spec.rb
index 1e365bf353a..92032f09b17 100644
--- a/spec/requests/api/members_spec.rb
+++ b/spec/requests/api/members_spec.rb
@@ -30,20 +30,29 @@ describe API::Members, api: true do
let(:route) { get api("/#{source_type.pluralize}/#{source.id}/members", stranger) }
end
- context 'when authenticated as a non-member' do
- %i[access_requester stranger].each do |type|
- context "as a #{type}" do
- it 'returns 200' do
- user = public_send(type)
- get api("/#{source_type.pluralize}/#{source.id}/members", user)
+ %i[master developer access_requester stranger].each do |type|
+ context "when authenticated as a #{type}" do
+ it 'returns 200' do
+ user = public_send(type)
+ get api("/#{source_type.pluralize}/#{source.id}/members", user)
- expect(response).to have_http_status(200)
- expect(json_response.size).to eq(2)
- end
+ expect(response).to have_http_status(200)
+ expect(json_response.size).to eq(2)
+ expect(json_response.map { |u| u['id'] }).to match_array [master.id, developer.id]
end
end
end
+ it 'does not return invitees' do
+ create(:"#{source_type}_member", invite_token: '123', invite_email: 'test@abc.com', source: source, user: nil)
+
+ get api("/#{source_type.pluralize}/#{source.id}/members", developer)
+
+ expect(response).to have_http_status(200)
+ expect(json_response.size).to eq(2)
+ expect(json_response.map { |u| u['id'] }).to match_array [master.id, developer.id]
+ end
+
it 'finds members with query string' do
get api("/#{source_type.pluralize}/#{source.id}/members", developer), query: master.username