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:
authorTiago Botelho <tiagonbotelho@hotmail.com>2018-01-22 21:10:56 +0300
committerTiago Botelho <tiagonbotelho@hotmail.com>2018-02-06 16:35:35 +0300
commitbc78ae6985ee37f9ac2ffc2dbf6f445078d16038 (patch)
tree1b53d4292becd29f1fe37a4fbb3e1562b3b80c40 /spec/requests/api/internal_spec.rb
parent32b2ff26011a5274bdb8a3dd41ad360a67c3148a (diff)
Add specs
Diffstat (limited to 'spec/requests/api/internal_spec.rb')
-rw-r--r--spec/requests/api/internal_spec.rb36
1 files changed, 26 insertions, 10 deletions
diff --git a/spec/requests/api/internal_spec.rb b/spec/requests/api/internal_spec.rb
index 884a258fd12..5f6790312e4 100644
--- a/spec/requests/api/internal_spec.rb
+++ b/spec/requests/api/internal_spec.rb
@@ -366,25 +366,28 @@ describe API::Internal do
end
end
- context 'project as /namespace/project' do
+ context 'project as namespace/project' do
it do
- pull(key, project_with_repo_path('/' + project.full_path))
+ push(key, project_with_repo_path(project.full_path))
expect(response).to have_gitlab_http_status(200)
expect(json_response["status"]).to be_truthy
expect(json_response["repository_path"]).to eq(project.repository.path_to_repo)
expect(json_response["gl_repository"]).to eq("project-#{project.id}")
end
- end
- context 'project as namespace/project' do
- it do
- pull(key, project_with_repo_path(project.full_path))
+ context 'when project does not exist' do
+ it 'creates a new project' do
+ path = "#{user.namespace.path}/notexist.git"
- expect(response).to have_gitlab_http_status(200)
- expect(json_response["status"]).to be_truthy
- expect(json_response["repository_path"]).to eq(project.repository.path_to_repo)
- expect(json_response["gl_repository"]).to eq("project-#{project.id}")
+ expect do
+ push_with_path(key, path)
+ end.to change { Project.count }.by(1)
+
+ expect(response).to have_gitlab_http_status(200)
+ expect(json_response["status"]).to be_truthy
+ expect(json_response["gitaly"]["repository"]["relative_path"]).to eq(path)
+ end
end
end
end
@@ -818,6 +821,19 @@ describe API::Internal do
end
end
+ context 'with new project data' do
+ it 'returns new project message on the response' do
+ new_project = Gitlab::Checks::NewProject.new(user, project, 'http')
+ new_project.add_new_project_message
+
+ post api("/internal/post_receive"), valid_params
+
+ expect(response).to have_gitlab_http_status(200)
+ expect(json_response["new_project_message"]).to be_present
+ expect(json_response["new_project_message"]).to eq(new_project.new_project_message)
+ end
+ end
+
context 'with an orphaned write deploy key' do
it 'does not try to notify that project moved' do
allow_any_instance_of(Gitlab::Identifier).to receive(:identify).and_return(nil)