diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-08-20 21:42:06 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-08-20 21:42:06 +0300 |
commit | 6e4e1050d9dba2b7b2523fdd1768823ab85feef4 (patch) | |
tree | 78be5963ec075d80116a932011d695dd33910b4e /spec/models/group_spec.rb | |
parent | 1ce776de4ae122aba3f349c02c17cebeaa8ecf07 (diff) |
Add latest changes from gitlab-org/gitlab@13-3-stable-ee
Diffstat (limited to 'spec/models/group_spec.rb')
-rw-r--r-- | spec/models/group_spec.rb | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/spec/models/group_spec.rb b/spec/models/group_spec.rb index 4184f2d07cc..3eb74da09e1 100644 --- a/spec/models/group_spec.rb +++ b/spec/models/group_spec.rb @@ -26,6 +26,7 @@ RSpec.describe Group do it { is_expected.to have_many(:container_repositories) } it { is_expected.to have_many(:milestones) } it { is_expected.to have_many(:iterations) } + it { is_expected.to have_many(:group_deploy_keys) } describe '#members & #requesters' do let(:requester) { create(:user) } @@ -1540,4 +1541,48 @@ RSpec.describe Group do end end end + + describe '#default_owner' do + let(:group) { build(:group) } + + context 'the group has owners' do + before do + group.add_owner(create(:user)) + group.add_owner(create(:user)) + end + + it 'is the first owner' do + expect(group.default_owner) + .to eq(group.owners.first) + .and be_a(User) + end + end + + context 'the group has a parent' do + let(:parent) { build(:group) } + + before do + group.parent = parent + parent.add_owner(create(:user)) + end + + it 'is the first owner of the parent' do + expect(group.default_owner) + .to eq(parent.default_owner) + .and be_a(User) + end + end + + context 'we fallback to group.owner' do + before do + group.owner = build(:user) + end + + it 'is the group.owner' do + expect(group.default_owner) + .to eq(group.owner) + .and be_a(User) + end + end + end end |