Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStan Hu <stanhu@gmail.com>2017-10-18 02:02:32 +0300
committerStan Hu <stanhu@gmail.com>2017-10-18 02:02:32 +0300
commit891a9ce8b0839fb478ca5704022b2e921097fe27 (patch)
treeec314e86f62f046cb96650be6d076276f23ff453 /spec/models/namespace_spec.rb
parentbd46c8abfd5ee964c47eff0ace021e45cbbe6687 (diff)
parentb3f749036ea919de3982c81b157ab2d790ecb4c5 (diff)
Merge branch 'master' into sh-security-fix-backports-master
Diffstat (limited to 'spec/models/namespace_spec.rb')
-rw-r--r--spec/models/namespace_spec.rb14
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) }