diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-10-21 07:08:36 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-10-21 07:08:36 +0000 |
commit | 48aff82709769b098321c738f3444b9bdaa694c6 (patch) | |
tree | e00c7c43e2d9b603a5a6af576b1685e400410dee /spec/lib/gitlab/git_access_spec.rb | |
parent | 879f5329ee916a948223f8f43d77fba4da6cd028 (diff) | |
download | gitlab-ce-48aff82709769b098321c738f3444b9bdaa694c6.tar.gz |
Add latest changes from gitlab-org/gitlab@13-5-stable-eev13.5.0-rc42
Diffstat (limited to 'spec/lib/gitlab/git_access_spec.rb')
-rw-r--r-- | spec/lib/gitlab/git_access_spec.rb | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/spec/lib/gitlab/git_access_spec.rb b/spec/lib/gitlab/git_access_spec.rb index 85567ab2e55..21607edbc32 100644 --- a/spec/lib/gitlab/git_access_spec.rb +++ b/spec/lib/gitlab/git_access_spec.rb @@ -420,6 +420,13 @@ RSpec.describe Gitlab::GitAccess do expect { pull_access_check }.to raise_forbidden('Your account has been blocked.') end + it 'disallows users that are blocked pending approval to pull' do + project.add_maintainer(user) + user.block_pending_approval + + expect { pull_access_check }.to raise_forbidden('Your account is pending approval from your administrator and hence blocked.') + end + it 'disallows deactivated users to pull' do project.add_maintainer(user) user.deactivate! @@ -428,14 +435,12 @@ RSpec.describe Gitlab::GitAccess do end context 'when the project repository does not exist' do - it 'returns not found' do + before do project.add_guest(user) - repo = project.repository - Gitlab::GitalyClient::StorageSettings.allow_disk_access { FileUtils.rm_rf(repo.path) } - - # Sanity check for rm_rf - expect(repo.exists?).to eq(false) + allow(project.repository).to receive(:exists?).and_return(false) + end + it 'returns not found' do expect { pull_access_check }.to raise_error(Gitlab::GitAccess::NotFoundError, 'A repository for this project does not exist yet.') end end @@ -917,6 +922,12 @@ RSpec.describe Gitlab::GitAccess do project.add_developer(user) end + it 'disallows users that are blocked pending approval to push' do + user.block_pending_approval + + expect { push_access_check }.to raise_forbidden('Your account is pending approval from your administrator and hence blocked.') + end + it 'does not allow deactivated users to push' do user.deactivate! |