diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-10-07 15:05:59 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-10-07 15:05:59 +0000 |
commit | 31040b5bfe48f8d73830f473513164427522b3a6 (patch) | |
tree | 6301b395ad45d7a0f84aa0f9c31373889208d09b /spec/models/namespace_spec.rb | |
parent | 185f428fa5e6123ffa0f29e307523da138e7b028 (diff) | |
download | gitlab-ce-31040b5bfe48f8d73830f473513164427522b3a6.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/models/namespace_spec.rb')
-rw-r--r-- | spec/models/namespace_spec.rb | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/spec/models/namespace_spec.rb b/spec/models/namespace_spec.rb index 797be0d1fe2..60f0dd49ff3 100644 --- a/spec/models/namespace_spec.rb +++ b/spec/models/namespace_spec.rb @@ -933,4 +933,25 @@ describe Namespace do end end end + + describe '#has_parent?' do + it 'returns true when the group has a parent' do + group = create(:group, :nested) + + expect(group.has_parent?).to be_truthy + end + + it 'returns true when the group has an unsaved parent' do + parent = build(:group) + group = build(:group, parent: parent) + + expect(group.has_parent?).to be_truthy + end + + it 'returns false when the group has no parent' do + group = create(:group, parent: nil) + + expect(group.has_parent?).to be_falsy + end + end end |