diff options
Diffstat (limited to 'spec/models/namespace_spec.rb')
-rw-r--r-- | spec/models/namespace_spec.rb | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/spec/models/namespace_spec.rb b/spec/models/namespace_spec.rb index aeb4eeb0b55..d22447c602f 100644 --- a/spec/models/namespace_spec.rb +++ b/spec/models/namespace_spec.rb @@ -28,6 +28,20 @@ describe Namespace, models: true do expect(nested).not_to be_valid expect(nested.errors[:parent_id].first).to eq('has too deep level of nesting') end + + describe 'reserved path validation' do + context 'nested group' do + let(:group) { build(:group, :nested, path: 'tree') } + + it { expect(group).not_to be_valid } + end + + context 'top-level group' do + let(:group) { build(:group, path: 'tree') } + + it { expect(group).to be_valid } + end + end end describe "Respond to" do @@ -36,7 +50,7 @@ describe Namespace, models: true do end describe '#to_param' do - it { expect(namespace.to_param).to eq(namespace.path) } + it { expect(namespace.to_param).to eq(namespace.full_path) } end describe '#human_name' do @@ -153,7 +167,7 @@ describe Namespace, models: true do describe :rm_dir do let!(:project) { create(:empty_project, namespace: namespace) } - let!(:path) { File.join(Gitlab.config.repositories.storages.default, namespace.path) } + let!(:path) { File.join(Gitlab.config.repositories.storages.default['path'], namespace.full_path) } it "removes its dirs when deleted" do namespace.destroy |