diff options
author | Stan Hu <stanhu@gmail.com> | 2017-10-17 16:02:32 -0700 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2017-10-17 16:02:32 -0700 |
commit | 891a9ce8b0839fb478ca5704022b2e921097fe27 (patch) | |
tree | ec314e86f62f046cb96650be6d076276f23ff453 /spec/models/namespace_spec.rb | |
parent | bd46c8abfd5ee964c47eff0ace021e45cbbe6687 (diff) | |
parent | b3f749036ea919de3982c81b157ab2d790ecb4c5 (diff) | |
download | gitlab-ce-891a9ce8b0839fb478ca5704022b2e921097fe27.tar.gz |
Merge branch 'master' into sh-security-fix-backports-master
Diffstat (limited to 'spec/models/namespace_spec.rb')
-rw-r--r-- | spec/models/namespace_spec.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/spec/models/namespace_spec.rb b/spec/models/namespace_spec.rb index a241d4111bd..90b768f595e 100644 --- a/spec/models/namespace_spec.rb +++ b/spec/models/namespace_spec.rb @@ -154,6 +154,20 @@ describe Namespace do end end + describe '#ancestors_upto', :nested_groups do + let(:parent) { create(:group) } + let(:child) { create(:group, parent: parent) } + let(:child2) { create(:group, parent: child) } + + it 'returns all ancestors when no namespace is given' do + expect(child2.ancestors_upto).to contain_exactly(child, parent) + end + + it 'includes ancestors upto but excluding the given ancestor' do + expect(child2.ancestors_upto(parent)).to contain_exactly(child) + end + end + describe '#move_dir', :request_store do let(:namespace) { create(:namespace) } let!(:project) { create(:project_empty_repo, namespace: namespace) } |