diff options
author | Sean McGivern <sean@gitlab.com> | 2016-07-13 15:38:21 +0100 |
---|---|---|
committer | Sean McGivern <sean@gitlab.com> | 2016-07-27 14:10:49 +0100 |
commit | dc4de2d8e2a42640cc24816fd28112c2f2d0bc91 (patch) | |
tree | 31b0b71bbf9cc0130fb3f7577af3d6fc9df8c152 /spec | |
parent | aed644ccc084223cb1f9c5d955569c5ff9eeaf88 (diff) | |
download | gitlab-ce-dc4de2d8e2a42640cc24816fd28112c2f2d0bc91.tar.gz |
Allow skipping users in autocompleteallow-skipping-users-in-autocomplete
Pass an array of user IDs in the `skip_users` param to have them
excluded from the results (unless they are explicitly included through
the `current_user` or `author_id` params).
Diffstat (limited to 'spec')
-rw-r--r-- | spec/controllers/autocomplete_controller_spec.rb | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/spec/controllers/autocomplete_controller_spec.rb b/spec/controllers/autocomplete_controller_spec.rb index 60c654f622d..ed0b7f9e240 100644 --- a/spec/controllers/autocomplete_controller_spec.rb +++ b/spec/controllers/autocomplete_controller_spec.rb @@ -163,4 +163,17 @@ describe AutocompleteController do expect(body.collect { |u| u['id'] }).not_to include(99999) end end + + context 'skip_users parameter included' do + before { sign_in(user) } + + it 'skips the user IDs passed' do + get(:users, skip_users: [user, user2].map(&:id)) + + other_user_ids = [non_member, project.owner, project.creator].map(&:id) + response_user_ids = JSON.parse(response.body).map { |user| user['id'] } + + expect(response_user_ids).to contain_exactly(*other_user_ids) + end + end end |