summaryrefslogtreecommitdiff
path: root/spec/services/projects
diff options
context:
space:
mode:
authorToon Claes <toon@gitlab.com>2017-04-25 14:44:40 +0200
committerToon Claes <toon@gitlab.com>2017-04-27 13:29:23 +0200
commit69f584edb4738d4de82f0301bb2ac8f6b3998814 (patch)
tree88a323c7a85c2b1625d00012d392034c2ccebd11 /spec/services/projects
parent025b04f3e7976ac8829e24fcb587d86574b0037d (diff)
downloadgitlab-ce-69f584edb4738d4de82f0301bb2ac8f6b3998814.tar.gz
Make namespace owner master of project upon creationtc-make-user-master-project-by-admin
When an admin creates a project in the namespace of a user, that user automatically gains master access to that project.
Diffstat (limited to 'spec/services/projects')
-rw-r--r--spec/services/projects/create_service_spec.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/spec/services/projects/create_service_spec.rb b/spec/services/projects/create_service_spec.rb
index 7a07ea618c0..033e6ecd18c 100644
--- a/spec/services/projects/create_service_spec.rb
+++ b/spec/services/projects/create_service_spec.rb
@@ -27,6 +27,22 @@ describe Projects::CreateService, '#execute', services: true do
end
end
+ context "admin creates project with other user's namespace_id" do
+ it 'sets the correct permissions' do
+ admin = create(:admin)
+ opts = {
+ name: 'GitLab',
+ namespace_id: user.namespace.id
+ }
+ project = create_project(admin, opts)
+
+ expect(project).to be_persisted
+ expect(project.owner).to eq(user)
+ expect(project.team.masters).to include(user, admin)
+ expect(project.namespace).to eq(user.namespace)
+ end
+ end
+
context 'group namespace' do
let(:group) do
create(:group).tap do |group|