summaryrefslogtreecommitdiff
path: root/spec/requests/git_http_spec.rb
diff options
context:
space:
mode:
authorTiago Botelho <tiagonbotelho@hotmail.com>2018-01-22 18:10:56 +0000
committerTiago Botelho <tiagonbotelho@hotmail.com>2018-02-06 13:35:35 +0000
commitbc78ae6985ee37f9ac2ffc2dbf6f445078d16038 (patch)
tree1b53d4292becd29f1fe37a4fbb3e1562b3b80c40 /spec/requests/git_http_spec.rb
parent32b2ff26011a5274bdb8a3dd41ad360a67c3148a (diff)
downloadgitlab-ce-bc78ae6985ee37f9ac2ffc2dbf6f445078d16038.tar.gz
Add specs
Diffstat (limited to 'spec/requests/git_http_spec.rb')
-rw-r--r--spec/requests/git_http_spec.rb38
1 files changed, 31 insertions, 7 deletions
diff --git a/spec/requests/git_http_spec.rb b/spec/requests/git_http_spec.rb
index 27bd22d6bca..c73db257b05 100644
--- a/spec/requests/git_http_spec.rb
+++ b/spec/requests/git_http_spec.rb
@@ -107,15 +107,39 @@ describe 'Git HTTP requests' do
let(:user) { create(:user) }
context "when the project doesn't exist" do
- let(:path) { 'doesnt/exist.git' }
+ context "when namespace doesn't exist" do
+ let(:path) { 'doesnt/exist.git' }
- it_behaves_like 'pulls require Basic HTTP Authentication'
- it_behaves_like 'pushes require Basic HTTP Authentication'
+ it_behaves_like 'pulls require Basic HTTP Authentication'
+ it_behaves_like 'pushes require Basic HTTP Authentication'
- context 'when authenticated' do
- it 'rejects downloads and uploads with 404 Not Found' do
- download_or_upload(path, user: user.username, password: user.password) do |response|
- expect(response).to have_gitlab_http_status(:not_found)
+ context 'when authenticated' do
+ it 'rejects downloads and uploads with 404 Not Found' do
+ download_or_upload(path, user: user.username, password: user.password) do |response|
+ expect(response).to have_gitlab_http_status(:not_found)
+ end
+ end
+ end
+ end
+
+ context 'when namespace exists' do
+ let(:path) { "#{user.namespace.path}/new-project.git"}
+
+ context 'when authenticated' do
+ it 'creates a new project under the existing namespace' do
+ expect do
+ upload(path, user: user.username, password: user.password) do |response|
+ expect(response).to have_gitlab_http_status(:ok)
+ end
+ end.to change { user.projects.count }.by(1)
+ end
+
+ it 'rejects upload with 404 Not Found when project is invalid' do
+ path = "#{user.namespace.path}/new.git"
+
+ upload(path, user: user.username, password: user.password) do |response|
+ expect(response).to have_gitlab_http_status(:not_found)
+ end
end
end
end