summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2016-12-13 16:59:49 +0200
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2016-12-13 16:59:49 +0200
commitd806230f9f95a2d08253f6c534ba69d1b9a498ea (patch)
tree96b9c5158648ae6e16ccb85ca2c284d0d4c68034 /spec
parent5c06875c39c8b525db41e73560f8cb1746119dd9 (diff)
downloadgitlab-ce-d806230f9f95a2d08253f6c534ba69d1b9a498ea.tar.gz
Add parents method to Namespace
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Diffstat (limited to 'spec')
-rw-r--r--spec/models/namespace_spec.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/spec/models/namespace_spec.rb b/spec/models/namespace_spec.rb
index 7f82e85563b..265ffc330e3 100644
--- a/spec/models/namespace_spec.rb
+++ b/spec/models/namespace_spec.rb
@@ -132,4 +132,12 @@ describe Namespace, models: true do
it { expect(group.full_path).to eq(group.path) }
it { expect(nested_group.full_path).to eq("#{group.path}/#{nested_group.path}") }
end
+
+ describe '#parents' do
+ let(:group) { create(:group) }
+ let(:nested_group) { create(:group, parent: group) }
+ let(:deep_nested_group) { create(:group, parent: nested_group) }
+
+ it { expect(deep_nested_group.parents).to eq([nested_group, group]) }
+ end
end