diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-11 15:09:26 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-11 15:09:26 +0300 |
commit | c9687bdf58e9d4a9c3942f587bd4841f42e3b5de (patch) | |
tree | a60a2e20f152483be6a92bacdf10564bbc96c664 /spec/controllers | |
parent | 3f3e4bcc50a3280d03299c2c263eafd9c8e3bd7b (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/controllers')
-rw-r--r-- | spec/controllers/boards/issues_controller_spec.rb | 12 | ||||
-rw-r--r-- | spec/controllers/dashboard/projects_controller_spec.rb | 51 |
2 files changed, 14 insertions, 49 deletions
diff --git a/spec/controllers/boards/issues_controller_spec.rb b/spec/controllers/boards/issues_controller_spec.rb index 605fff60c31..41c37cb84e5 100644 --- a/spec/controllers/boards/issues_controller_spec.rb +++ b/spec/controllers/boards/issues_controller_spec.rb @@ -57,6 +57,18 @@ describe Boards::IssuesController do expect(development.issues.map(&:relative_position)).not_to include(nil) end + it 'returns issues by closed_at in descending order in closed list' do + create(:closed_issue, project: project, title: 'New Issue 1', closed_at: 1.day.ago) + create(:closed_issue, project: project, title: 'New Issue 2', closed_at: 1.week.ago) + + list_issues user: user, board: board, list: board.lists.last.id + + expect(response).to have_gitlab_http_status(:ok) + expect(json_response['issues'].length).to eq(2) + expect(json_response['issues'][0]['title']).to eq('New Issue 1') + expect(json_response['issues'][1]['title']).to eq('New Issue 2') + end + it 'avoids N+1 database queries' do create(:labeled_issue, project: project, labels: [development]) control_count = ActiveRecord::QueryRecorder.new { list_issues(user: user, board: board, list: list2) }.count diff --git a/spec/controllers/dashboard/projects_controller_spec.rb b/spec/controllers/dashboard/projects_controller_spec.rb index 7ae31fc67aa..a13b56deb23 100644 --- a/spec/controllers/dashboard/projects_controller_spec.rb +++ b/spec/controllers/dashboard/projects_controller_spec.rb @@ -86,58 +86,11 @@ describe Dashboard::ProjectsController do end describe 'GET /starred.json' do - subject { get :starred, format: :json } - - let(:projects) { create_list(:project, 2, creator: user) } - before do - allow(Kaminari.config).to receive(:default_per_page).and_return(1) - - projects.each do |project| - project.add_developer(user) - create(:users_star_project, project_id: project.id, user_id: user.id) - end - end - - it 'returns success' do - subject - - expect(response).to have_gitlab_http_status(:ok) + get :starred, format: :json end - it 'paginates the records' do - subject - - expect(assigns(:projects).count).to eq(1) - end - end - end - - context 'atom requests' do - let(:user) { create(:user) } - - before do - sign_in(user) - end - - describe '#index' do - context 'project pagination' do - let(:projects) { create_list(:project, 2, creator: user) } - - before do - allow(Kaminari.config).to receive(:default_per_page).and_return(1) - - projects.each do |project| - project.add_developer(user) - end - end - - it 'does not paginate projects, even if page number is passed' do - get :index, format: :atom - - expect(assigns(:events).count).to eq(2) - end - end + it { is_expected.to respond_with(:success) } end end end |