diff options
author | Bob Van Landuyt <bob@vanlanduyt.co> | 2017-10-10 16:45:35 +0300 |
---|---|---|
committer | Bob Van Landuyt <bob@vanlanduyt.co> | 2017-10-10 17:55:02 +0300 |
commit | 9d1348d66838b4c5e25ba133d486239482973fca (patch) | |
tree | d7c56904b3f991c462be9c593ef9e130addd1442 /spec/models/namespace_spec.rb | |
parent | 7611e6a0f745393aa432e4201e8053072a263c2e (diff) |
Move the `ancestors_upto` to `Project` and `Namespace`
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 81d5ab7a6d3..4ce9f1b02e3 100644 --- a/spec/models/namespace_spec.rb +++ b/spec/models/namespace_spec.rb @@ -151,6 +151,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' do before do @namespace = create :namespace |