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:
authorOlaf Tomalka <olaf.tomalka@gmail.com>2016-09-07 00:51:08 +0300
committerOlaf Tomalka <olaf.tomalka@gmail.com>2016-09-07 00:51:08 +0300
commit636db1515c8b9429c5895845e5601ac33b2ac6b6 (patch)
treee28fb3d41487a5118c1905f82405962585c16380
parent3aa40153e08c959878ba5430d9700935a5195e48 (diff)
Higher code quality for fork to namespace API
-rw-r--r--CHANGELOG2
-rw-r--r--lib/api/projects.rb1
-rw-r--r--spec/requests/api/fork_spec.rb8
3 files changed, 5 insertions, 6 deletions
diff --git a/CHANGELOG b/CHANGELOG
index 49c0c906e62..e973dc322bd 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,7 +1,7 @@
Please view this file on the master branch, on stable branches it's out of date.
v 8.12.0 (unreleased)
- - Add abillity to fork to a specific namespace using API. @ritave <olaf@tomalka.me>
+ - Add ability to fork to a specific namespace using API. (ritave)
- Prepend blank line to `Closes` message on merge request linked to issue (lukehowell)
- Filter tags by name !6121
- Make push events have equal vertical spacing.
diff --git a/lib/api/projects.rb b/lib/api/projects.rb
index 5284d1d2305..4033f597859 100644
--- a/lib/api/projects.rb
+++ b/lib/api/projects.rb
@@ -204,7 +204,6 @@ module API
namespace = Namespace.find_by(id: namespace_id) || Namespace.find_by_path_or_name(namespace_id)
not_found!('Target Namespace') unless namespace
- authorize! :create_projects, namespace
attrs[:namespace] = namespace
end
diff --git a/spec/requests/api/fork_spec.rb b/spec/requests/api/fork_spec.rb
index 91b69384aad..06e3a2183c0 100644
--- a/spec/requests/api/fork_spec.rb
+++ b/spec/requests/api/fork_spec.rb
@@ -3,10 +3,10 @@ require 'spec_helper'
describe API::API, api: true do
include ApiHelpers
let(:user) { create(:user) }
- let(:user2) { create(:user, username: 'user2_name') }
+ let(:user2) { create(:user) }
let(:user3) { create(:user) }
let(:admin) { create(:admin) }
- let(:group) { create(:group, name: 'group_name') }
+ let(:group) { create(:group) }
let(:group2) do
group = create(:group, name: 'group2_name')
group.add_owner(user2)
@@ -94,7 +94,7 @@ describe API::API, api: true do
it 'fails if trying to fork to another user when not admin' do
post api("/projects/fork/#{project.id}", user2), namespace: admin.namespace.id
- expect(response).to have_http_status(403)
+ expect(response).to have_http_status(409)
end
it 'fails if trying to fork to non-existent namespace' do
@@ -114,7 +114,7 @@ describe API::API, api: true do
it 'fails to fork to not owned group' do
post api("/projects/fork/#{project.id}", user2), namespace: group.name
- expect(response).to have_http_status(403)
+ expect(response).to have_http_status(409)
end
it 'forks to not owned group when admin' do