diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-11 00:09:21 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-11 00:09:21 +0300 |
commit | 06bb4eba7828ce59fde366734828458c037059b4 (patch) | |
tree | 44b95a53123d91684cc1c67716ef87cc1c0964fb /spec/controllers | |
parent | 219eead23f9feb5da9ec378c451d773aea2dfe61 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/controllers')
-rw-r--r-- | spec/controllers/dashboard/projects_controller_spec.rb | 51 |
1 files changed, 49 insertions, 2 deletions
diff --git a/spec/controllers/dashboard/projects_controller_spec.rb b/spec/controllers/dashboard/projects_controller_spec.rb index a13b56deb23..7ae31fc67aa 100644 --- a/spec/controllers/dashboard/projects_controller_spec.rb +++ b/spec/controllers/dashboard/projects_controller_spec.rb @@ -86,11 +86,58 @@ 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 - get :starred, format: :json + 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 { is_expected.to respond_with(:success) } + it 'returns success' do + subject + + expect(response).to have_gitlab_http_status(:ok) + 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 end end end |