summaryrefslogtreecommitdiff
path: root/spec/models/namespace_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/models/namespace_spec.rb')
-rw-r--r--spec/models/namespace_spec.rb38
1 files changed, 38 insertions, 0 deletions
diff --git a/spec/models/namespace_spec.rb b/spec/models/namespace_spec.rb
index 1e06d0fd7b9..c93e6aafd75 100644
--- a/spec/models/namespace_spec.rb
+++ b/spec/models/namespace_spec.rb
@@ -281,6 +281,44 @@ describe Namespace do
end
end
+ shared_examples 'move_dir without repository storage feature' do |storage_version|
+ let(:namespace) { create(:namespace) }
+ let(:gitlab_shell) { namespace.gitlab_shell }
+ let!(:project) { create(:project_empty_repo, namespace: namespace, storage_version: storage_version) }
+
+ it 'calls namespace service' do
+ expect(gitlab_shell).to receive(:add_namespace).and_return(true)
+ expect(gitlab_shell).to receive(:mv_namespace).and_return(true)
+
+ namespace.move_dir
+ end
+ end
+
+ shared_examples 'move_dir with repository storage feature' do |storage_version|
+ let(:namespace) { create(:namespace) }
+ let(:gitlab_shell) { namespace.gitlab_shell }
+ let!(:project) { create(:project_empty_repo, namespace: namespace, storage_version: storage_version) }
+
+ it 'does not call namespace service' do
+ expect(gitlab_shell).not_to receive(:add_namespace)
+ expect(gitlab_shell).not_to receive(:mv_namespace)
+
+ namespace.move_dir
+ end
+ end
+
+ context 'project is without repository storage feature' do
+ [nil, 0].each do |storage_version|
+ it_behaves_like 'move_dir without repository storage feature', storage_version
+ end
+ end
+
+ context 'project has repository storage feature' do
+ [1, 2].each do |storage_version|
+ it_behaves_like 'move_dir with repository storage feature', storage_version
+ end
+ end
+
context 'with subgroups' do
let(:parent) { create(:group, name: 'parent', path: 'parent') }
let(:new_parent) { create(:group, name: 'new_parent', path: 'new_parent') }