Commit e9d7b4f7 authored by Rémy Coutable's avatar Rémy Coutable

Invert method's naming

Signed-off-by: default avatarRémy Coutable <remy@rymai.me>
parent c8b13119
...@@ -17,7 +17,7 @@ module Members ...@@ -17,7 +17,7 @@ module Members
member = find_member!(scope) member = find_member!(scope)
raise Gitlab::Access::AccessDeniedError if cannot_destroy_member?(member) raise Gitlab::Access::AccessDeniedError unless can_destroy_member?(member)
AuthorizedDestroyService.new(member, current_user).execute AuthorizedDestroyService.new(member, current_user).execute
end end
...@@ -35,8 +35,8 @@ module Members ...@@ -35,8 +35,8 @@ module Members
end end
end end
def cannot_destroy_member?(member) def can_destroy_member?(member)
!member || !can?(current_user, action_member_permission(:destroy, member), member) member && can?(current_user, action_member_permission(:destroy, member), member)
end end
end end
end end
...@@ -213,7 +213,7 @@ describe API::AccessRequests, api: true do ...@@ -213,7 +213,7 @@ describe API::AccessRequests, api: true do
end.to change { source.requesters.count }.by(-1) end.to change { source.requesters.count }.by(-1)
end end
context 'user_id matches a member' do context 'user_id matches a member, not an access requester' do
it 'returns 404' do it 'returns 404' do
expect do expect do
delete api("/#{source_type.pluralize}/#{source.id}/access_requests/#{developer.id}", master) delete api("/#{source_type.pluralize}/#{source.id}/access_requests/#{developer.id}", master)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment