summaryrefslogtreecommitdiff
path: root/spec/models/group_spec.rb
diff options
context:
space:
mode:
authorGosia Ksionek <mksionek@gitlab.com>2019-04-04 14:19:57 +0000
committerJames Lopez <james@gitlab.com>2019-04-04 14:19:57 +0000
commit17bee986bc971cc7d04c4b767cc026577eb56c6a (patch)
tree87f71cd3b3af84ad02e196d3a619f13b634827da /spec/models/group_spec.rb
parent702f18261a2ac0b45e2b002055950816ad34e92c (diff)
downloadgitlab-ce-17bee986bc971cc7d04c4b767cc026577eb56c6a.tar.gz
Add cr remarks
Chnage method used in model to make it more efficient database-wise Add additional spec
Diffstat (limited to 'spec/models/group_spec.rb')
-rw-r--r--spec/models/group_spec.rb26
1 files changed, 26 insertions, 0 deletions
diff --git a/spec/models/group_spec.rb b/spec/models/group_spec.rb
index 2c6abddca17..b2ffd5812ab 100644
--- a/spec/models/group_spec.rb
+++ b/spec/models/group_spec.rb
@@ -364,6 +364,32 @@ describe Group do
it { expect(group.has_maintainer?(nil)).to be_falsey }
end
+ describe '#last_owner?' do
+ before do
+ @members = setup_group_members(group)
+ end
+
+ it { expect(group.last_owner?(@members[:owner])).to be_truthy }
+
+ context 'with two owners' do
+ before do
+ create(:group_member, :owner, group: group)
+ end
+
+ it { expect(group.last_owner?(@members[:owner])).to be_falsy }
+ end
+
+ context 'with owners from a parent', :postgresql do
+ before do
+ parent_group = create(:group)
+ create(:group_member, :owner, group: parent_group)
+ group.update(parent: parent_group)
+ end
+
+ it { expect(group.last_owner?(@members[:owner])).to be_falsy }
+ end
+ end
+
describe '#lfs_enabled?' do
context 'LFS enabled globally' do
before do