Commit 127b4557 authored by Rémy Coutable's avatar Rémy Coutable

Fix spec/ee/spec/controllers/autocomplete_controller_spec.rb

Signed-off-by: default avatarRémy Coutable <remy@rymai.me>
parent 07f37e01
...@@ -32,9 +32,7 @@ class AutocompleteUsersFinder ...@@ -32,9 +32,7 @@ class AutocompleteUsersFinder
items = items.where.not(id: skip_users) if skip_users.present? items = items.where.not(id: skip_users) if skip_users.present?
# EE # EE
items_by_push_ability = load_users_by_push_ability(items) items = load_users_by_push_ability(items) || items.page(page).per(per_page)
items = items.page(page).per(per_page) unless items_by_push_ability
# EE
if params[:todo_filter].present? && current_user if params[:todo_filter].present? && current_user
items = items.todo_authors(current_user.id, params[:todo_state_filter]) items = items.todo_authors(current_user.id, params[:todo_state_filter])
......
...@@ -19,7 +19,7 @@ describe AutocompleteController do ...@@ -19,7 +19,7 @@ describe AutocompleteController do
get(:users, project_id: project.id, push_code_to_protected_branches: 'true') get(:users, project_id: project.id, push_code_to_protected_branches: 'true')
end end
it 'returns authorized users' do it 'returns authorized users', :aggregate_failures do
expect(json_response).to be_kind_of(Array) expect(json_response).to be_kind_of(Array)
expect(json_response.size).to eq(1) expect(json_response.size).to eq(1)
expect(json_response.map { |u| u["username"] }).to match_array([user.username]) expect(json_response.map { |u| u["username"] }).to match_array([user.username])
...@@ -34,7 +34,7 @@ describe AutocompleteController do ...@@ -34,7 +34,7 @@ describe AutocompleteController do
get(:users, project_id: project.id, push_code: 'true') get(:users, project_id: project.id, push_code: 'true')
end end
it 'returns authorized users' do it 'returns authorized users', :aggregate_failures do
expect(json_response).to be_kind_of(Array) expect(json_response).to be_kind_of(Array)
expect(json_response.size).to eq(2) expect(json_response.size).to eq(2)
expect(json_response.map { |user| user["username"] }).to match_array([user.username, user2.username]) expect(json_response.map { |user| user["username"] }).to match_array([user.username, user2.username])
...@@ -46,7 +46,7 @@ describe AutocompleteController do ...@@ -46,7 +46,7 @@ describe AutocompleteController do
get(:users, project_id: project.id, push_code_to_protected_branches: true, current_user: true) get(:users, project_id: project.id, push_code_to_protected_branches: true, current_user: true)
end end
it 'returns authorized users' do it 'returns authorized users', :aggregate_failures do
expect(json_response).to be_kind_of(Array) expect(json_response).to be_kind_of(Array)
expect(json_response.size).to eq(1) expect(json_response.size).to eq(1)
expect(json_response.map { |u| u["username"] }).to match_array([user.username]) expect(json_response.map { |u| u["username"] }).to match_array([user.username])
...@@ -70,7 +70,7 @@ describe AutocompleteController do ...@@ -70,7 +70,7 @@ describe AutocompleteController do
get(:project_groups, project_id: project.id) get(:project_groups, project_id: project.id)
end end
it 'returns a single group' do it 'returns a single group', :aggregate_failures do
expect(json_response).to be_kind_of(Array) expect(json_response).to be_kind_of(Array)
expect(json_response.size).to eq(1) expect(json_response.size).to eq(1)
expect(json_response.first.values_at('id', 'name')).to eq [matching_group.id, matching_group.name] expect(json_response.first.values_at('id', 'name')).to eq [matching_group.id, matching_group.name]
......
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