diff options
author | Sean McGivern <sean@gitlab.com> | 2017-07-24 13:35:54 +0300 |
---|---|---|
committer | Sean McGivern <sean@gitlab.com> | 2017-07-24 18:58:04 +0300 |
commit | ccac2abeba419f16029c40f29063f1812c9e159c (patch) | |
tree | 975ca2e9f3fc91fae1ce0c775c8c267256fa7480 /spec/models/group_spec.rb | |
parent | f81ed493e1f02e5a197df3e2df9c5e42cb09e7ff (diff) |
Don't treat anonymous users as owners when group has pending invites
The `members` table can have entries where `user_id: nil`, because people can
invite group members by email. We never want to include those as members,
because it might cause confusion with the anonymous (logged out) user.
Diffstat (limited to 'spec/models/group_spec.rb')
-rw-r--r-- | spec/models/group_spec.rb | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/spec/models/group_spec.rb b/spec/models/group_spec.rb index 770176451fe..d8e868265ed 100644 --- a/spec/models/group_spec.rb +++ b/spec/models/group_spec.rb @@ -236,6 +236,7 @@ describe Group, models: true do describe '#has_owner?' do before do @members = setup_group_members(group) + create(:group_member, :invited, :owner, group: group) end it { expect(group.has_owner?(@members[:owner])).to be_truthy } @@ -244,11 +245,13 @@ describe Group, models: true do it { expect(group.has_owner?(@members[:reporter])).to be_falsey } it { expect(group.has_owner?(@members[:guest])).to be_falsey } it { expect(group.has_owner?(@members[:requester])).to be_falsey } + it { expect(group.has_owner?(nil)).to be_falsey } end describe '#has_master?' do before do @members = setup_group_members(group) + create(:group_member, :invited, :master, group: group) end it { expect(group.has_master?(@members[:owner])).to be_falsey } @@ -257,6 +260,7 @@ describe Group, models: true do it { expect(group.has_master?(@members[:reporter])).to be_falsey } it { expect(group.has_master?(@members[:guest])).to be_falsey } it { expect(group.has_master?(@members[:requester])).to be_falsey } + it { expect(group.has_master?(nil)).to be_falsey } end describe '#lfs_enabled?' do |