diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-01-18 22:00:14 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-01-18 22:00:14 +0300 |
commit | 05f0ebba3a2c8ddf39e436f412dc2ab5bf1353b2 (patch) | |
tree | 11d0f2a6ec31c7793c184106cedc2ded3d9a2cc5 /spec/controllers/import/available_namespaces_controller_spec.rb | |
parent | ec73467c23693d0db63a797d10194da9e72a74af (diff) |
Add latest changes from gitlab-org/gitlab@15-8-stable-eev15.8.0-rc42
Diffstat (limited to 'spec/controllers/import/available_namespaces_controller_spec.rb')
-rw-r--r-- | spec/controllers/import/available_namespaces_controller_spec.rb | 109 |
1 files changed, 0 insertions, 109 deletions
diff --git a/spec/controllers/import/available_namespaces_controller_spec.rb b/spec/controllers/import/available_namespaces_controller_spec.rb deleted file mode 100644 index 26ea1d92189..00000000000 --- a/spec/controllers/import/available_namespaces_controller_spec.rb +++ /dev/null @@ -1,109 +0,0 @@ -# frozen_string_literal: true - -require 'spec_helper' - -RSpec.describe Import::AvailableNamespacesController do - let_it_be(:user) { create(:user) } - - before do - sign_in(user) - end - - describe "GET index" do - context "when having group with role never allowed to create projects" do - using RSpec::Parameterized::TableSyntax - - where( - role: [:guest, :reporter], - default_project_creation_access: [::Gitlab::Access::MAINTAINER_PROJECT_ACCESS, ::Gitlab::Access::DEVELOPER_MAINTAINER_PROJECT_ACCESS], - group_project_creation_level: [nil, ::Gitlab::Access::MAINTAINER_PROJECT_ACCESS, ::Gitlab::Access::DEVELOPER_MAINTAINER_PROJECT_ACCESS]) - - with_them do - before do - stub_application_setting(default_project_creation: default_project_creation_access) - end - - it "does not include group with access level #{params[:role]} in list" do - group = create(:group, project_creation_level: group_project_creation_level) - group.add_member(user, role) - get :index - - expect(response).to have_gitlab_http_status(:ok) - expect(json_response).not_to include({ - 'id' => group.id, - 'full_path' => group.full_path - }) - end - end - end - - context "when having group with role always allowed to create projects" do - using RSpec::Parameterized::TableSyntax - - where( - role: [:maintainer, :owner], - default_project_creation_access: [::Gitlab::Access::MAINTAINER_PROJECT_ACCESS, ::Gitlab::Access::DEVELOPER_MAINTAINER_PROJECT_ACCESS], - group_project_creation_level: [nil, ::Gitlab::Access::MAINTAINER_PROJECT_ACCESS, ::Gitlab::Access::DEVELOPER_MAINTAINER_PROJECT_ACCESS]) - - with_them do - before do - stub_application_setting(default_project_creation: default_project_creation_access) - end - - it "does not include group with access level #{params[:role]} in list" do - group = create(:group, project_creation_level: group_project_creation_level) - group.add_member(user, role) - get :index - - expect(response).to have_gitlab_http_status(:ok) - expect(json_response).to include({ - 'id' => group.id, - 'full_path' => group.full_path - }) - end - end - end - - context "when having developer role" do - using RSpec::Parameterized::TableSyntax - - where(:default_project_creation_access, :project_creation_level, :is_visible) do - ::Gitlab::Access::MAINTAINER_PROJECT_ACCESS | nil | false - ::Gitlab::Access::MAINTAINER_PROJECT_ACCESS | ::Gitlab::Access::DEVELOPER_MAINTAINER_PROJECT_ACCESS | true - ::Gitlab::Access::DEVELOPER_MAINTAINER_PROJECT_ACCESS | nil | true - ::Gitlab::Access::DEVELOPER_MAINTAINER_PROJECT_ACCESS | ::Gitlab::Access::MAINTAINER_PROJECT_ACCESS | false - end - - with_them do - before do - stub_application_setting(default_project_creation: default_project_creation_access) - end - - it "#{params[:is_visible] ? 'includes' : 'does not include'} group with access level #{params[:role]} in list" do - group = create(:group, project_creation_level: project_creation_level) - group.add_member(user, :developer) - - get :index - - expect(response).to have_gitlab_http_status(:ok) - expect(json_response).send(is_visible ? 'to' : 'not_to', include({ - 'id' => group.id, - 'full_path' => group.full_path - })) - end - end - end - - context "with an anonymous user" do - before do - sign_out(user) - end - - it "redirects to sign-in page" do - get :index - - expect(response).to redirect_to(new_user_session_path) - end - end - end -end |