Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'spec/lib/gitlab/git_access_project_spec.rb')
-rw-r--r--spec/lib/gitlab/git_access_project_spec.rb17
1 files changed, 16 insertions, 1 deletions
diff --git a/spec/lib/gitlab/git_access_project_spec.rb b/spec/lib/gitlab/git_access_project_spec.rb
index f80915b2be9..953b74cf1a9 100644
--- a/spec/lib/gitlab/git_access_project_spec.rb
+++ b/spec/lib/gitlab/git_access_project_spec.rb
@@ -9,6 +9,7 @@ RSpec.describe Gitlab::GitAccessProject do
let(:actor) { user }
let(:project_path) { project.path }
let(:namespace_path) { project&.namespace&.path }
+ let(:repository_path) { "#{namespace_path}/#{project_path}.git" }
let(:protocol) { 'ssh' }
let(:authentication_abilities) { %i[read_project download_code push_code] }
let(:changes) { Gitlab::GitAccess::ANY }
@@ -17,7 +18,7 @@ RSpec.describe Gitlab::GitAccessProject do
let(:access) do
described_class.new(actor, container, protocol,
authentication_abilities: authentication_abilities,
- repository_path: project_path, namespace_path: namespace_path)
+ repository_path: repository_path)
end
describe '#check_namespace!' do
@@ -103,6 +104,20 @@ RSpec.describe Gitlab::GitAccessProject do
end
end
+ context 'when namespace is blank' do
+ let(:repository_path) { 'project.git' }
+
+ it_behaves_like 'no project is created' do
+ let(:raise_specific_error) { raise_namespace_not_found }
+ end
+ end
+
+ context 'when namespace does not exist' do
+ let(:namespace_path) { 'unknown' }
+
+ it_behaves_like 'no project is created'
+ end
+
context 'when user cannot create project in namespace' do
let(:user2) { create(:user) }
let(:namespace_path) { user2.namespace.path }