diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-11-06 09:06:23 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-11-06 09:06:23 +0000 |
commit | d15180e00b209d0fbe3d8ce61b3af269aecdf7f5 (patch) | |
tree | e24bcc044a3e471811b91ade8a23120a27210c3f /spec/models/namespace_spec.rb | |
parent | 505c40d537244b35807129ade0c577f752e9d564 (diff) | |
download | gitlab-ce-d15180e00b209d0fbe3d8ce61b3af269aecdf7f5.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/models/namespace_spec.rb')
-rw-r--r-- | spec/models/namespace_spec.rb | 38 |
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') } |