diff options
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 |