summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorRémy Coutable <remy@rymai.me>2016-04-14 15:13:08 +0000
committerRémy Coutable <remy@rymai.me>2016-04-14 15:13:08 +0000
commit4a514b27e96bfa6024e26b0a7500deec1d89391b (patch)
tree91367d6bcd0dab0b60333b8234e85296267bd5d6 /spec
parent39f6cfcc3eb6d8c52e936a576ac4a8c9b15169fe (diff)
parenta8ea2c18959c700913132d8a2d7ce3a211303c10 (diff)
downloadgitlab-ce-4a514b27e96bfa6024e26b0a7500deec1d89391b.tar.gz
Merge branch 'issue_15155' into 'master'
Setup visibility level for project when transfering for a group fixes #15155 See merge request !3707
Diffstat (limited to 'spec')
-rw-r--r--spec/services/projects/transfer_service_spec.rb23
1 files changed, 23 insertions, 0 deletions
diff --git a/spec/services/projects/transfer_service_spec.rb b/spec/services/projects/transfer_service_spec.rb
index c46259431aa..06017317339 100644
--- a/spec/services/projects/transfer_service_spec.rb
+++ b/spec/services/projects/transfer_service_spec.rb
@@ -38,4 +38,27 @@ describe Projects::TransferService, services: true do
def transfer_project(project, user, new_namespace)
Projects::TransferService.new(project, user).execute(new_namespace)
end
+
+ context 'visibility level' do
+ let(:internal_group) { create(:group, :internal) }
+
+ before { internal_group.add_owner(user) }
+
+ context 'when namespace visibility level < project visibility level' do
+ let(:public_project) { create(:project, :public, namespace: user.namespace) }
+
+ before { transfer_project(public_project, user, internal_group) }
+
+ it { expect(public_project.visibility_level).to eq(internal_group.visibility_level) }
+ end
+
+ context 'when namespace visibility level > project visibility level' do
+ let(:private_project) { create(:project, :private, namespace: user.namespace) }
+
+ before { transfer_project(private_project, user, internal_group) }
+
+ it { expect(private_project.visibility_level).to eq(Gitlab::VisibilityLevel::PRIVATE) }
+ end
+ end
+
end