diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-09-27 18:06:20 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-09-27 18:06:20 +0000 |
commit | 2abb1b54c0305b359b178d6660810e865f619c22 (patch) | |
tree | e388953a0566ef9844b0b98cdb34236049721a14 /spec/controllers/boards | |
parent | 8320f7956d72986f5a7c850874fce4f8b5a8e015 (diff) | |
download | gitlab-ce-2abb1b54c0305b359b178d6660810e865f619c22.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/controllers/boards')
-rw-r--r-- | spec/controllers/boards/lists_controller_spec.rb | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/spec/controllers/boards/lists_controller_spec.rb b/spec/controllers/boards/lists_controller_spec.rb index 77b5872fcb3..bc46d02556b 100644 --- a/spec/controllers/boards/lists_controller_spec.rb +++ b/spec/controllers/boards/lists_controller_spec.rb @@ -14,6 +14,10 @@ describe Boards::ListsController do end describe 'GET index' do + before do + create(:list, board: board) + end + it 'returns a successful 200 response' do read_board_list user: user, board: board @@ -22,27 +26,22 @@ describe Boards::ListsController do end it 'returns a list of board lists' do - create(:list, board: board) - read_board_list user: user, board: board expect(response).to match_response_schema('lists') expect(json_response.length).to eq 3 end - it 'avoids n+1 queries when serializing lists' do - list_1 = create(:list, board: board) - list_1.update_preferences_for(user, { collapsed: true }) - - control_count = ActiveRecord::QueryRecorder.new { read_board_list user: user, board: board }.count - - list_2 = create(:list, board: board) - list_2.update_preferences_for(user, { collapsed: true }) + context 'when another user has list preferences' do + before do + board.lists.first.update_preferences_for(guest, collapsed: true) + end - list_3 = create(:list, board: board) - list_3.update_preferences_for(user, { collapsed: true }) + it 'returns the complete list of board lists' do + read_board_list user: user, board: board - expect { read_board_list user: user, board: board }.not_to exceed_query_limit(control_count) + expect(json_response.length).to eq 3 + end end context 'with unauthorized user' do |