diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-07-20 15:26:25 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-07-20 15:26:25 +0300 |
commit | a09983ae35713f5a2bbb100981116d31ce99826e (patch) | |
tree | 2ee2af7bd104d57086db360a7e6d8c9d5d43667a /spec/finders/group_projects_finder_spec.rb | |
parent | 18c5ab32b738c0b6ecb4d0df3994000482f34bd8 (diff) |
Add latest changes from gitlab-org/gitlab@13-2-stable-ee
Diffstat (limited to 'spec/finders/group_projects_finder_spec.rb')
-rw-r--r-- | spec/finders/group_projects_finder_spec.rb | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/spec/finders/group_projects_finder_spec.rb b/spec/finders/group_projects_finder_spec.rb index 7499461ad8f..14f2bb017c6 100644 --- a/spec/finders/group_projects_finder_spec.rb +++ b/spec/finders/group_projects_finder_spec.rb @@ -46,6 +46,18 @@ RSpec.describe GroupProjectsFinder do context 'without subgroups projects' do it { is_expected.to match_array([shared_project_3, shared_project_2, shared_project_1, private_project, public_project]) } end + + context "with min access level" do + let!(:shared_project_4) { create(:project, :internal, path: '8') } + + before do + shared_project_4.project_group_links.create(group_access: Gitlab::Access::REPORTER, group: group) + end + + let(:params) { { min_access_level: Gitlab::Access::MAINTAINER } } + + it { is_expected.to match_array([shared_project_3, shared_project_2, shared_project_1, private_project, public_project]) } + end end end @@ -171,6 +183,38 @@ RSpec.describe GroupProjectsFinder do end end + describe 'feature availability' do + let!(:project_with_issues_disabled) { create(:project, :issues_disabled, :internal, path: '9') } + let!(:project_with_merge_request_disabled) { create(:project, :merge_requests_disabled, :internal, path: '10') } + + before do + project_with_issues_disabled.project_group_links.create!(group_access: Gitlab::Access::REPORTER, group: group) + project_with_merge_request_disabled.project_group_links.create!(group_access: Gitlab::Access::REPORTER, group: group) + end + + context 'without issues and merge request enabled' do + it { is_expected.to match_array([public_project, shared_project_1, shared_project_3, project_with_issues_disabled, project_with_merge_request_disabled]) } + end + + context 'with issues enabled' do + let(:params) { { with_issues_enabled: true } } + + it { is_expected.to match_array([public_project, shared_project_1, shared_project_3, project_with_merge_request_disabled]) } + end + + context 'with merge request enabled' do + let(:params) { { with_merge_requests_enabled: true } } + + it { is_expected.to match_array([public_project, shared_project_1, shared_project_3, project_with_issues_disabled]) } + end + + context 'with issues and merge request enabled' do + let(:params) { { with_merge_requests_enabled: true, with_issues_enabled: true } } + + it { is_expected.to match_array([public_project, shared_project_1, shared_project_3]) } + end + end + describe 'limiting' do context 'without limiting' do it 'returns all projects' do |