summaryrefslogtreecommitdiff
path: root/spec/services/projects
diff options
context:
space:
mode:
authorFelipe Artur <felipefac@gmail.com>2016-04-13 15:28:10 -0300
committerFelipe Artur <felipefac@gmail.com>2016-04-13 15:28:10 -0300
commit11f46b459e9d97900cb71f7f6bd313b5e18fbaa6 (patch)
treedf1b114345fd7d94e360aa73ef9ceaefe2b3e6fd /spec/services/projects
parentf026e53c4df5b0b3bb7435c05d3c8662afe45881 (diff)
downloadgitlab-ce-11f46b459e9d97900cb71f7f6bd313b5e18fbaa6.tar.gz
Setup visibility level for project when transfering for a group
Diffstat (limited to 'spec/services/projects')
-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