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/project_spec.rb | |
parent | 7611e6a0f745393aa432e4201e8053072a263c2e (diff) |
Move the `ancestors_upto` to `Project` and `Namespace`
Diffstat (limited to 'spec/models/project_spec.rb')
-rw-r--r-- | spec/models/project_spec.rb | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/spec/models/project_spec.rb b/spec/models/project_spec.rb index def2e0983ac..dedf3008994 100644 --- a/spec/models/project_spec.rb +++ b/spec/models/project_spec.rb @@ -1731,6 +1731,21 @@ describe Project do it { expect(project.gitea_import?).to be true } end + describe '#ancestors_upto', :nested_groups do + let(:parent) { create(:group) } + let(:child) { create(:group, parent: parent) } + let(:child2) { create(:group, parent: child) } + let(:project) { create(:project, namespace: child2) } + + it 'returns all ancestors when no namespace is given' do + expect(project.ancestors_upto).to contain_exactly(child2, child, parent) + end + + it 'includes ancestors upto but excluding the given ancestor' do + expect(project.ancestors_upto(parent)).to contain_exactly(child2, child) + end + end + describe '#lfs_enabled?' do let(:project) { create(:project) } |