diff options
Diffstat (limited to 'spec/finders/projects')
-rw-r--r-- | spec/finders/projects/members/effective_access_level_finder_spec.rb | 41 | ||||
-rw-r--r-- | spec/finders/projects/topics_finder_spec.rb | 6 |
2 files changed, 31 insertions, 16 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 diff --git a/spec/finders/projects/topics_finder_spec.rb b/spec/finders/projects/topics_finder_spec.rb index 28802c5d49e..3812f0757bc 100644 --- a/spec/finders/projects/topics_finder_spec.rb +++ b/spec/finders/projects/topics_finder_spec.rb @@ -9,9 +9,9 @@ RSpec.describe Projects::TopicsFinder do let!(:topic2) { create(:topic, name: 'topicC') } let!(:topic3) { create(:topic, name: 'topicA') } - let!(:project1) { create(:project, namespace: user.namespace, topic_list: 'topicC, topicA, topicB') } - let!(:project2) { create(:project, namespace: user.namespace, topic_list: 'topicC, topicA') } - let!(:project3) { create(:project, namespace: user.namespace, topic_list: 'topicC') } + let!(:project1) { create(:project, :public, namespace: user.namespace, topic_list: 'topicC, topicA, topicB') } + let!(:project2) { create(:project, :public, namespace: user.namespace, topic_list: 'topicC, topicA') } + let!(:project3) { create(:project, :public, namespace: user.namespace, topic_list: 'topicC') } describe '#execute' do it 'returns topics' do |