diff options
author | Lin Jen-Shin <godfat@godfat.org> | 2018-06-26 12:58:51 +0300 |
---|---|---|
committer | Lin Jen-Shin <godfat@godfat.org> | 2018-06-26 12:58:51 +0300 |
commit | d5a1910f0ce24cf88bc7f0279904a8d5088e2ffa (patch) | |
tree | 735aa5278bd547f8d83d6cfbb92e9aef4681a9c7 /spec/models | |
parent | 2024522b51ae672df3b04ec0ed3d17eefcb45264 (diff) |
Port Namespace#root_ancestor to CE
Diffstat (limited to 'spec/models')
-rw-r--r-- | spec/models/namespace_spec.rb | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/spec/models/namespace_spec.rb b/spec/models/namespace_spec.rb index 18b01c3e6b7..70f1a1c8b38 100644 --- a/spec/models/namespace_spec.rb +++ b/spec/models/namespace_spec.rb @@ -655,6 +655,19 @@ describe Namespace do end end + describe '#root_ancestor' do + it 'returns the top most ancestor', :nested_groups do + root_group = create(:group) + nested_group = create(:group, parent: root_group) + deep_nested_group = create(:group, parent: nested_group) + very_deep_nested_group = create(:group, parent: deep_nested_group) + + expect(nested_group.root_ancestor).to eq(root_group) + expect(deep_nested_group.root_ancestor).to eq(root_group) + expect(very_deep_nested_group.root_ancestor).to eq(root_group) + end + end + describe '#remove_exports' do let(:legacy_project) { create(:project, :with_export, :legacy_storage, namespace: namespace) } let(:hashed_project) { create(:project, :with_export, namespace: namespace) } |