diff options
Diffstat (limited to 'spec/finders/projects/members/effective_access_level_finder_spec.rb')
-rw-r--r-- | spec/finders/projects/members/effective_access_level_finder_spec.rb | 41 |
1 files changed, 28 insertions, 13 deletions
diff --git a/spec/finders/projects/members/effective_access_level_finder_spec.rb b/spec/finders/projects/members/effective_access_level_finder_spec.rb index 33fbb5aca30..bec327835f6 100644 --- a/spec/finders/projects/members/effective_access_level_finder_spec.rb +++ b/spec/finders/projects/members/effective_access_level_finder_spec.rb @@ -11,13 +11,13 @@ RSpec.describe Projects::Members::EffectiveAccessLevelFinder, '#execute' do context 'for a personal project' do let_it_be(:project) { create(:project) } - shared_examples_for 'includes access level of the owner of the project as Maintainer' do - it 'includes access level of the owner of the project as Maintainer' do + shared_examples_for 'includes access level of the owner of the project' do + it 'includes access level of the owner of the project as Owner' do expect(subject).to( contain_exactly( hash_including( 'user_id' => project.namespace.owner.id, - 'access_level' => Gitlab::Access::MAINTAINER + 'access_level' => Gitlab::Access::OWNER ) ) ) @@ -25,7 +25,7 @@ RSpec.describe Projects::Members::EffectiveAccessLevelFinder, '#execute' do end context 'when the project owner is a member of the project' do - it_behaves_like 'includes access level of the owner of the project as Maintainer' + it_behaves_like 'includes access level of the owner of the project' end context 'when the project owner is not explicitly a member of the project' do @@ -33,7 +33,7 @@ RSpec.describe Projects::Members::EffectiveAccessLevelFinder, '#execute' do project.members.find_by(user_id: project.namespace.owner.id).destroy! end - it_behaves_like 'includes access level of the owner of the project as Maintainer' + it_behaves_like 'includes access level of the owner of the project' end end @@ -84,17 +84,32 @@ RSpec.describe Projects::Members::EffectiveAccessLevelFinder, '#execute' do context 'for a project within a group' do context 'project in a root group' do - it 'includes access levels of users who are direct members of the parent group' do - group_member = create(:group_member, :developer, source: group) + context 'includes access levels of users who are direct members of the parent group' do + it 'when access level is developer' do + group_member = create(:group_member, :developer, source: group) - expect(subject).to( - include( - hash_including( - 'user_id' => group_member.user.id, - 'access_level' => Gitlab::Access::DEVELOPER + expect(subject).to( + include( + hash_including( + 'user_id' => group_member.user.id, + 'access_level' => Gitlab::Access::DEVELOPER + ) ) ) - ) + end + + it 'when access level is owner' do + group_member = create(:group_member, :owner, source: group) + + expect(subject).to( + include( + hash_including( + 'user_id' => group_member.user.id, + 'access_level' => Gitlab::Access::OWNER + ) + ) + ) + end end end |