diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-02-18 12:45:46 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-02-18 12:45:46 +0300 |
commit | a7b3560714b4d9cc4ab32dffcd1f74a284b93580 (patch) | |
tree | 7452bd5c3545c2fa67a28aa013835fb4fa071baf /spec/requests/users_controller_spec.rb | |
parent | ee9173579ae56a3dbfe5afe9f9410c65bb327ca7 (diff) |
Add latest changes from gitlab-org/gitlab@14-8-stable-eev14.8.0-rc42
Diffstat (limited to 'spec/requests/users_controller_spec.rb')
-rw-r--r-- | spec/requests/users_controller_spec.rb | 34 |
1 files changed, 29 insertions, 5 deletions
diff --git a/spec/requests/users_controller_spec.rb b/spec/requests/users_controller_spec.rb index dacc11eece7..d033ce15b00 100644 --- a/spec/requests/users_controller_spec.rb +++ b/spec/requests/users_controller_spec.rb @@ -506,6 +506,7 @@ RSpec.describe UsersController do describe 'GET #contributed' do let(:project) { create(:project, :public) } + let(:aimed_for_deletion_project) { create(:project, :public, :archived, marked_for_deletion_at: 3.days.ago) } subject do get user_contributed_projects_url author.username, format: format @@ -516,7 +517,10 @@ RSpec.describe UsersController do project.add_developer(public_user) project.add_developer(private_user) + aimed_for_deletion_project.add_developer(public_user) + aimed_for_deletion_project.add_developer(private_user) create(:push_event, project: project, author: author) + create(:push_event, project: aimed_for_deletion_project, author: author) subject end @@ -526,6 +530,11 @@ RSpec.describe UsersController do expect(response).to have_gitlab_http_status(:ok) expect(response.body).not_to be_empty end + + it 'does not list projects aimed for deletion' do + expect(response).to have_gitlab_http_status(:ok) + expect(assigns(:contributed_projects)).to eq([project]) + end end %i(html json).each do |format| @@ -557,6 +566,7 @@ RSpec.describe UsersController do describe 'GET #starred' do let(:project) { create(:project, :public) } + let(:aimed_for_deletion_project) { create(:project, :public, :archived, marked_for_deletion_at: 3.days.ago) } subject do get user_starred_projects_url author.username, format: format @@ -574,6 +584,11 @@ RSpec.describe UsersController do expect(response).to have_gitlab_http_status(:ok) expect(response.body).not_to be_empty end + + it 'does not list projects aimed for deletion' do + expect(response).to have_gitlab_http_status(:ok) + expect(assigns(:starred_projects)).to eq([project]) + end end %i(html json).each do |format| @@ -634,13 +649,13 @@ RSpec.describe UsersController do end describe 'GET #exists' do - before do - sign_in(user) + context 'when user exists' do + before do + sign_in(user) - allow(::Gitlab::ApplicationRateLimiter).to receive(:throttled?).and_return(false) - end + allow(::Gitlab::ApplicationRateLimiter).to receive(:throttled?).and_return(false) + end - context 'when user exists' do it 'returns JSON indicating the user exists' do get user_exists_url user.username @@ -661,6 +676,15 @@ RSpec.describe UsersController do end context 'when the user does not exist' do + it 'will not show a signup page if registration is disabled' do + stub_application_setting(signup_enabled: false) + get user_exists_url 'foo' + + expected_json = { error: "You must be authenticated to access this path." }.to_json + expect(response).to have_gitlab_http_status(:unauthorized) + expect(response.body).to eq(expected_json) + end + it 'returns JSON indicating the user does not exist' do get user_exists_url 'foo' |