summaryrefslogtreecommitdiff
path: root/spec/controllers/projects
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-01-20 09:16:11 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2022-01-20 09:16:11 +0000
commitedaa33dee2ff2f7ea3fac488d41558eb5f86d68c (patch)
tree11f143effbfeba52329fb7afbd05e6e2a3790241 /spec/controllers/projects
parentd8a5691316400a0f7ec4f83832698f1988eb27c1 (diff)
downloadgitlab-ce-76a9e64d004e0c02c35b8165ca38d005afb5e823.tar.gz
Add latest changes from gitlab-org/gitlab@14-7-stable-eev14.7.0-rc42
Diffstat (limited to 'spec/controllers/projects')
-rw-r--r--spec/controllers/projects/boards_controller_spec.rb18
-rw-r--r--spec/controllers/projects/mattermosts_controller_spec.rb4
-rw-r--r--spec/controllers/projects/merge_requests/diffs_controller_spec.rb5
-rw-r--r--spec/controllers/projects/notes_controller_spec.rb9
-rw-r--r--spec/controllers/projects/packages/infrastructure_registry_controller_spec.rb24
-rw-r--r--spec/controllers/projects/packages/packages_controller_spec.rb28
-rw-r--r--spec/controllers/projects/prometheus/metrics_controller_spec.rb20
-rw-r--r--spec/controllers/projects/raw_controller_spec.rb136
-rw-r--r--spec/controllers/projects/repositories_controller_spec.rb19
-rw-r--r--spec/controllers/projects/security/configuration_controller_spec.rb25
-rw-r--r--spec/controllers/projects/service_hook_logs_controller_spec.rb4
-rw-r--r--spec/controllers/projects/services_controller_spec.rb4
-rw-r--r--spec/controllers/projects/settings/access_tokens_controller_spec.rb82
-rw-r--r--spec/controllers/projects/settings/ci_cd_controller_spec.rb13
14 files changed, 168 insertions, 223 deletions
diff --git a/spec/controllers/projects/boards_controller_spec.rb b/spec/controllers/projects/boards_controller_spec.rb
index 48a12a27911..cde3a8d4761 100644
--- a/spec/controllers/projects/boards_controller_spec.rb
+++ b/spec/controllers/projects/boards_controller_spec.rb
@@ -22,15 +22,6 @@ RSpec.describe Projects::BoardsController do
expect(assigns(:boards_endpoint)).to eq project_boards_path(project)
end
- it 'pushes swimlanes_buffered_rendering feature flag' do
- allow(controller).to receive(:push_frontend_feature_flag).and_call_original
-
- expect(controller).to receive(:push_frontend_feature_flag)
- .with(:swimlanes_buffered_rendering, project, default_enabled: :yaml)
-
- list_boards
- end
-
context 'when format is HTML' do
it 'renders template' do
list_boards
@@ -125,15 +116,6 @@ RSpec.describe Projects::BoardsController do
describe 'GET show' do
let!(:board) { create(:board, project: project) }
- it 'pushes swimlanes_buffered_rendering feature flag' do
- allow(controller).to receive(:push_frontend_feature_flag).and_call_original
-
- expect(controller).to receive(:push_frontend_feature_flag)
- .with(:swimlanes_buffered_rendering, project, default_enabled: :yaml)
-
- read_board board: board
- end
-
it 'sets boards_endpoint instance variable to a boards path' do
read_board board: board
diff --git a/spec/controllers/projects/mattermosts_controller_spec.rb b/spec/controllers/projects/mattermosts_controller_spec.rb
index edec8c3e9c6..596cd5c1a20 100644
--- a/spec/controllers/projects/mattermosts_controller_spec.rb
+++ b/spec/controllers/projects/mattermosts_controller_spec.rb
@@ -60,9 +60,9 @@ RSpec.describe Projects::MattermostsController do
it 'redirects to the new page' do
subject
- service = project.integrations.last
+ integration = project.integrations.last
- expect(subject).to redirect_to(edit_project_service_url(project, service))
+ expect(subject).to redirect_to(edit_project_integration_path(project, integration))
end
end
end
diff --git a/spec/controllers/projects/merge_requests/diffs_controller_spec.rb b/spec/controllers/projects/merge_requests/diffs_controller_spec.rb
index f7370a1a1ac..a5c59b7e22d 100644
--- a/spec/controllers/projects/merge_requests/diffs_controller_spec.rb
+++ b/spec/controllers/projects/merge_requests/diffs_controller_spec.rb
@@ -205,7 +205,6 @@ RSpec.describe Projects::MergeRequests::DiffsController do
let(:collection) { Gitlab::Diff::FileCollection::MergeRequestDiff }
let(:expected_options) do
{
- environment: nil,
merge_request: merge_request,
merge_request_diff: merge_request.merge_request_diff,
merge_request_diffs: merge_request.merge_request_diffs,
@@ -280,7 +279,6 @@ RSpec.describe Projects::MergeRequests::DiffsController do
let(:collection) { Gitlab::Diff::FileCollection::MergeRequestDiff }
let(:expected_options) do
{
- environment: nil,
merge_request: merge_request,
merge_request_diff: merge_request.merge_request_diff,
merge_request_diffs: merge_request.merge_request_diffs,
@@ -303,7 +301,6 @@ RSpec.describe Projects::MergeRequests::DiffsController do
let(:collection) { Gitlab::Diff::FileCollection::Commit }
let(:expected_options) do
{
- environment: nil,
merge_request: merge_request,
merge_request_diff: nil,
merge_request_diffs: merge_request.merge_request_diffs,
@@ -330,7 +327,6 @@ RSpec.describe Projects::MergeRequests::DiffsController do
let(:collection) { Gitlab::Diff::FileCollection::MergeRequestDiff }
let(:expected_options) do
{
- environment: nil,
merge_request: merge_request,
merge_request_diff: merge_request.merge_request_diff,
merge_request_diffs: merge_request.merge_request_diffs,
@@ -494,7 +490,6 @@ RSpec.describe Projects::MergeRequests::DiffsController do
def collection_arguments(pagination_data = {})
{
- environment: nil,
merge_request: merge_request,
commit: nil,
diff_view: :inline,
diff --git a/spec/controllers/projects/notes_controller_spec.rb b/spec/controllers/projects/notes_controller_spec.rb
index 66af546b113..2df31904380 100644
--- a/spec/controllers/projects/notes_controller_spec.rb
+++ b/spec/controllers/projects/notes_controller_spec.rb
@@ -762,9 +762,12 @@ RSpec.describe Projects::NotesController do
end
end
- it_behaves_like 'request exceeding rate limit', :clean_gitlab_redis_cache do
- let(:params) { request_params.except(:format) }
- let(:request_full_path) { project_notes_path(project) }
+ it_behaves_like 'create notes request exceeding rate limit', :clean_gitlab_redis_cache do
+ let(:current_user) { user }
+
+ def request
+ post :create, params: request_params.except(:format)
+ end
end
end
diff --git a/spec/controllers/projects/packages/infrastructure_registry_controller_spec.rb b/spec/controllers/projects/packages/infrastructure_registry_controller_spec.rb
index fc741d0f3f6..707edeaeee3 100644
--- a/spec/controllers/projects/packages/infrastructure_registry_controller_spec.rb
+++ b/spec/controllers/projects/packages/infrastructure_registry_controller_spec.rb
@@ -41,5 +41,29 @@ RSpec.describe Projects::Packages::InfrastructureRegistryController do
it_behaves_like 'returning response status', :not_found
end
+
+ context 'with package file pending destruction' do
+ let_it_be(:package_file_pending_destruction) { create(:package_file, :pending_destruction, package: terraform_module) }
+
+ let(:terraform_module_package_file) { terraform_module.package_files.first }
+
+ it 'does not return them' do
+ subject
+
+ expect(assigns(:package_files)).to contain_exactly(terraform_module_package_file)
+ end
+
+ context 'with packages_installable_package_files disabled' do
+ before do
+ stub_feature_flags(packages_installable_package_files: false)
+ end
+
+ it 'returns them' do
+ subject
+
+ expect(assigns(:package_files)).to contain_exactly(package_file_pending_destruction, terraform_module_package_file)
+ end
+ end
+ end
end
end
diff --git a/spec/controllers/projects/packages/packages_controller_spec.rb b/spec/controllers/projects/packages/packages_controller_spec.rb
new file mode 100644
index 00000000000..da9cae47c62
--- /dev/null
+++ b/spec/controllers/projects/packages/packages_controller_spec.rb
@@ -0,0 +1,28 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+RSpec.describe Projects::Packages::PackagesController do
+ let_it_be(:project) { create(:project, :public) }
+
+ let(:page) { :index }
+ let(:additional_parameters) { {} }
+
+ subject do
+ get page, params: additional_parameters.merge({
+ project_id: project,
+ namespace_id: project.namespace
+ })
+ end
+
+ context 'GET #index' do
+ it_behaves_like 'returning response status', :ok
+ end
+
+ context 'GET #show' do
+ let(:page) { :show }
+ let(:additional_parameters) { { id: 1 } }
+
+ it_behaves_like 'returning response status', :ok
+ end
+end
diff --git a/spec/controllers/projects/prometheus/metrics_controller_spec.rb b/spec/controllers/projects/prometheus/metrics_controller_spec.rb
index 5338b77bd08..7dfa283195e 100644
--- a/spec/controllers/projects/prometheus/metrics_controller_spec.rb
+++ b/spec/controllers/projects/prometheus/metrics_controller_spec.rb
@@ -141,7 +141,7 @@ RSpec.describe Projects::Prometheus::MetricsController do
expect(flash[:notice]).to include('Metric was successfully added.')
- expect(response).to redirect_to(edit_project_service_path(project, ::Integrations::Prometheus))
+ expect(response).to redirect_to(edit_project_integration_path(project, ::Integrations::Prometheus))
end
end
@@ -157,6 +157,22 @@ RSpec.describe Projects::Prometheus::MetricsController do
end
end
+ describe 'PUT #update' do
+ context 'metric is updated' do
+ let_it_be(:metric) { create(:prometheus_metric, project: project) }
+
+ let(:metric_params) { { prometheus_metric: { title: 'new_title' }, id: metric.id } }
+
+ it 'shows a success flash message' do
+ put :update, params: project_params(metric_params)
+
+ expect(metric.reload.title).to eq('new_title')
+ expect(flash[:notice]).to include('Metric was successfully updated.')
+ expect(response).to redirect_to(edit_project_integration_path(project, ::Integrations::Prometheus))
+ end
+ end
+ end
+
describe 'DELETE #destroy' do
context 'format html' do
let!(:metric) { create(:prometheus_metric, project: project) }
@@ -164,7 +180,7 @@ RSpec.describe Projects::Prometheus::MetricsController do
it 'destroys the metric' do
delete :destroy, params: project_params(id: metric.id)
- expect(response).to redirect_to(edit_project_service_path(project, ::Integrations::Prometheus))
+ expect(response).to redirect_to(edit_project_integration_path(project, ::Integrations::Prometheus))
expect(PrometheusMetric.find_by(id: metric.id)).to be_nil
end
end
diff --git a/spec/controllers/projects/raw_controller_spec.rb b/spec/controllers/projects/raw_controller_spec.rb
index 4d99afb6b1f..e0d88fa799f 100644
--- a/spec/controllers/projects/raw_controller_spec.rb
+++ b/spec/controllers/projects/raw_controller_spec.rb
@@ -8,6 +8,7 @@ RSpec.describe Projects::RawController do
let_it_be(:project) { create(:project, :public, :repository) }
let(:inline) { nil }
+ let(:params) { {} }
describe 'GET #show' do
def get_show
@@ -15,9 +16,9 @@ RSpec.describe Projects::RawController do
params: {
namespace_id: project.namespace,
project_id: project,
- id: filepath,
+ id: file_path,
inline: inline
- })
+ }.merge(params))
end
subject { get_show }
@@ -33,7 +34,7 @@ RSpec.describe Projects::RawController do
end
context 'regular filename' do
- let(:filepath) { 'master/CONTRIBUTING.md' }
+ let(:file_path) { 'master/CONTRIBUTING.md' }
it 'delivers ASCII file' do
allow(Gitlab::Workhorse).to receive(:send_git_blob).and_call_original
@@ -60,7 +61,7 @@ RSpec.describe Projects::RawController do
end
context 'image header' do
- let(:filepath) { 'master/files/images/6049019_460s.jpg' }
+ let(:file_path) { 'master/files/images/6049019_460s.jpg' }
it 'leaves image content disposition' do
subject
@@ -77,44 +78,30 @@ RSpec.describe Projects::RawController do
context 'with LFS files' do
let(:filename) { 'lfs_object.iso' }
- let(:filepath) { "be93687/files/lfs/#{filename}" }
+ let(:file_path) { "be93687/files/lfs/#{filename}" }
it_behaves_like 'a controller that can serve LFS files'
it_behaves_like 'project cache control headers'
include_examples 'single Gitaly request'
end
- context 'when the endpoint receives requests above the limit', :clean_gitlab_redis_rate_limiting do
+ context 'when the endpoint receives requests above the limit' do
let(:file_path) { 'master/README.md' }
+ let(:path_without_ref) { 'README.md' }
before do
- stub_application_setting(raw_blob_request_limit: 5)
+ allow(::Gitlab::ApplicationRateLimiter).to(
+ receive(:throttled?).with(:raw_blob, scope: [project, path_without_ref]).and_return(true)
+ )
end
- it 'prevents from accessing the raw file', :request_store do
- execute_raw_requests(requests: 5, project: project, file_path: file_path)
-
- expect { execute_raw_requests(requests: 1, project: project, file_path: file_path) }
- .to change { Gitlab::GitalyClient.get_request_count }.by(0)
+ it 'prevents from accessing the raw file' do
+ expect { get_show }.not_to change { Gitlab::GitalyClient.get_request_count }
expect(response.body).to eq(_('You cannot access the raw file. Please wait a minute.'))
expect(response).to have_gitlab_http_status(:too_many_requests)
end
- it 'logs the event on auth.log', quarantine: 'https://gitlab.com/gitlab-org/gitlab/-/issues/345889' do
- attributes = {
- message: 'Application_Rate_Limiter_Request',
- env: :raw_blob_request_limit,
- remote_ip: '0.0.0.0',
- request_method: 'GET',
- path: "/#{project.full_path}/-/raw/#{file_path}"
- }
-
- expect(Gitlab::AuthLogger).to receive(:error).with(attributes).once
-
- execute_raw_requests(requests: 6, project: project, file_path: file_path)
- end
-
context 'when receiving an external storage request' do
let(:token) { 'letmein' }
@@ -126,62 +113,10 @@ RSpec.describe Projects::RawController do
end
it 'does not prevent from accessing the raw file' do
- request.headers['X-Gitlab-External-Storage-Token'] = token
- execute_raw_requests(requests: 6, project: project, file_path: file_path)
-
- expect(response).to have_gitlab_http_status(:ok)
- end
- end
-
- context 'when the request uses a different version of a commit' do
- it 'prevents from accessing the raw file' do
- # 3 times with the normal sha
- commit_sha = project.repository.commit.sha
- file_path = "#{commit_sha}/README.md"
-
- execute_raw_requests(requests: 3, project: project, file_path: file_path)
-
- # 3 times with the modified version
- modified_sha = commit_sha.gsub(commit_sha[0..5], commit_sha[0..5].upcase)
- modified_path = "#{modified_sha}/README.md"
-
- execute_raw_requests(requests: 3, project: project, file_path: modified_path)
-
- expect(response.body).to eq(_('You cannot access the raw file. Please wait a minute.'))
- expect(response).to have_gitlab_http_status(:too_many_requests)
- end
- end
-
- context 'when the throttling has been disabled' do
- before do
- stub_application_setting(raw_blob_request_limit: 0)
- end
-
- it 'does not prevent from accessing the raw file' do
- execute_raw_requests(requests: 10, project: project, file_path: file_path)
-
- expect(response).to have_gitlab_http_status(:ok)
- end
- end
-
- context 'with case-sensitive files' do
- it 'prevents from accessing the specific file' do
- create_file_in_repo(project, 'master', 'master', 'readme.md', 'Add readme.md')
- create_file_in_repo(project, 'master', 'master', 'README.md', 'Add README.md')
-
- commit_sha = project.repository.commit.sha
- file_path = "#{commit_sha}/readme.md"
-
- # Accessing downcase version of readme
- execute_raw_requests(requests: 6, project: project, file_path: file_path)
-
- expect(response.body).to eq(_('You cannot access the raw file. Please wait a minute.'))
- expect(response).to have_gitlab_http_status(:too_many_requests)
+ expect(::Gitlab::ApplicationRateLimiter).not_to receive(:throttled?)
- # Accessing upcase version of readme
- file_path = "#{commit_sha}/README.md"
-
- execute_raw_requests(requests: 1, project: project, file_path: file_path)
+ request.headers['X-Gitlab-External-Storage-Token'] = token
+ get_show
expect(response).to have_gitlab_http_status(:ok)
end
@@ -201,7 +136,7 @@ RSpec.describe Projects::RawController do
context 'when no token is provided' do
it 'redirects to sign in page' do
- execute_raw_requests(requests: 1, project: project, file_path: file_path)
+ get_show
expect(response).to have_gitlab_http_status(:found)
expect(response.location).to end_with('/users/sign_in')
@@ -209,13 +144,11 @@ RSpec.describe Projects::RawController do
end
context 'when a token param is present' do
- subject(:execute_raw_request_with_token_in_params) do
- execute_raw_requests(requests: 1, project: project, file_path: file_path, token: token)
- end
-
context 'when token is correct' do
+ let(:params) { { token: token } }
+
it 'calls the action normally' do
- execute_raw_request_with_token_in_params
+ get_show
expect(response).to have_gitlab_http_status(:ok)
end
@@ -224,7 +157,7 @@ RSpec.describe Projects::RawController do
let_it_be(:user) { create(:user, password_expires_at: 2.minutes.ago) }
it 'redirects to sign in page' do
- execute_raw_request_with_token_in_params
+ get_show
expect(response).to have_gitlab_http_status(:found)
expect(response.location).to end_with('/users/sign_in')
@@ -236,7 +169,7 @@ RSpec.describe Projects::RawController do
let_it_be(:user) { create(:omniauth_user, provider: 'ldap', password_expires_at: 2.minutes.ago) }
it 'calls the action normally' do
- execute_raw_request_with_token_in_params
+ get_show
expect(response).to have_gitlab_http_status(:ok)
end
@@ -245,10 +178,10 @@ RSpec.describe Projects::RawController do
end
context 'when token is incorrect' do
- let(:token) { 'foobar' }
+ let(:params) { { token: 'foobar' } }
it 'redirects to sign in page' do
- execute_raw_request_with_token_in_params
+ get_show
expect(response).to have_gitlab_http_status(:found)
expect(response.location).to end_with('/users/sign_in')
@@ -257,14 +190,13 @@ RSpec.describe Projects::RawController do
end
context 'when a token header is present' do
- subject(:execute_raw_request_with_token_in_headers) do
+ before do
request.headers['X-Gitlab-Static-Object-Token'] = token
- execute_raw_requests(requests: 1, project: project, file_path: file_path)
end
context 'when token is correct' do
it 'calls the action normally' do
- execute_raw_request_with_token_in_headers
+ get_show
expect(response).to have_gitlab_http_status(:ok)
end
@@ -273,7 +205,7 @@ RSpec.describe Projects::RawController do
let_it_be(:user) { create(:user, password_expires_at: 2.minutes.ago) }
it 'redirects to sign in page' do
- execute_raw_request_with_token_in_headers
+ get_show
expect(response).to have_gitlab_http_status(:found)
expect(response.location).to end_with('/users/sign_in')
@@ -285,7 +217,7 @@ RSpec.describe Projects::RawController do
let_it_be(:user) { create(:omniauth_user, provider: 'ldap', password_expires_at: 2.minutes.ago) }
it 'calls the action normally' do
- execute_raw_request_with_token_in_headers
+ get_show
expect(response).to have_gitlab_http_status(:ok)
end
@@ -297,7 +229,7 @@ RSpec.describe Projects::RawController do
let(:token) { 'foobar' }
it 'redirects to sign in page' do
- execute_raw_request_with_token_in_headers
+ get_show
expect(response).to have_gitlab_http_status(:found)
expect(response.location).to end_with('/users/sign_in')
@@ -344,14 +276,4 @@ RSpec.describe Projects::RawController do
end
end
end
-
- def execute_raw_requests(requests:, project:, file_path:, **params)
- requests.times do
- get :show, params: {
- namespace_id: project.namespace,
- project_id: project,
- id: file_path
- }.merge(params)
- end
- end
end
diff --git a/spec/controllers/projects/repositories_controller_spec.rb b/spec/controllers/projects/repositories_controller_spec.rb
index f7cf55d8a95..1370ec9cc0b 100644
--- a/spec/controllers/projects/repositories_controller_spec.rb
+++ b/spec/controllers/projects/repositories_controller_spec.rb
@@ -210,6 +210,25 @@ RSpec.describe Projects::RepositoriesController do
expect(response).to have_gitlab_http_status(:found)
end
end
+
+ context 'when token is migrated' do
+ let(:user) { create(:user, static_object_token: '') }
+ let(:token) { 'Test' }
+
+ it 'calls the action normally' do
+ user.update_column(:static_object_token, token)
+
+ get :archive, params: { namespace_id: project.namespace, project_id: project, id: 'master', token: token }, format: 'zip'
+ expect(user.static_object_token).to eq(token)
+ expect(response).to have_gitlab_http_status(:ok)
+
+ user.update_column(:static_object_token_encrypted, Gitlab::CryptoHelper.aes256_gcm_encrypt(token))
+
+ get :archive, params: { namespace_id: project.namespace, project_id: project, id: 'master', token: token }, format: 'zip'
+ expect(user.static_object_token).to eq(token)
+ expect(response).to have_gitlab_http_status(:ok)
+ end
+ end
end
context 'when a token header is present' do
diff --git a/spec/controllers/projects/security/configuration_controller_spec.rb b/spec/controllers/projects/security/configuration_controller_spec.rb
index 848db16fb02..1ce0fcd85db 100644
--- a/spec/controllers/projects/security/configuration_controller_spec.rb
+++ b/spec/controllers/projects/security/configuration_controller_spec.rb
@@ -36,6 +36,31 @@ RSpec.describe Projects::Security::ConfigurationController do
expect(response).to have_gitlab_http_status(:ok)
expect(response).to render_template(:show)
end
+
+ it 'responds with configuration data json' do
+ get :show, params: { namespace_id: project.namespace, project_id: project, format: :json }
+
+ features = json_response['features']
+ sast_feature = features.find { |feature| feature['type'] == 'sast' }
+ dast_feature = features.find { |feature| feature['type'] == 'dast' }
+
+ expect(response).to have_gitlab_http_status(:ok)
+ expect(sast_feature['available']).to be_truthy
+ expect(dast_feature['available']).to be_falsey
+ end
+
+ context 'with feature flag unify_security_configuration turned off' do
+ before do
+ stub_feature_flags(unify_security_configuration: false)
+ end
+
+ it 'responds with empty configuration data json' do
+ get :show, params: { namespace_id: project.namespace, project_id: project, format: :json }
+
+ expect(response).to have_gitlab_http_status(:ok)
+ expect(json_response).to be_empty
+ end
+ end
end
end
end
diff --git a/spec/controllers/projects/service_hook_logs_controller_spec.rb b/spec/controllers/projects/service_hook_logs_controller_spec.rb
index 9caa4a06b44..be78668aa88 100644
--- a/spec/controllers/projects/service_hook_logs_controller_spec.rb
+++ b/spec/controllers/projects/service_hook_logs_controller_spec.rb
@@ -11,7 +11,7 @@ RSpec.describe Projects::ServiceHookLogsController do
{
namespace_id: project.namespace,
project_id: project,
- service_id: integration.to_param,
+ integration_id: integration.to_param,
id: log.id
}
end
@@ -44,7 +44,7 @@ RSpec.describe Projects::ServiceHookLogsController do
it 'executes the hook and redirects to the service form' do
expect_any_instance_of(ServiceHook).to receive(:execute)
expect_any_instance_of(described_class).to receive(:set_hook_execution_notice)
- expect(subject).to redirect_to(edit_project_service_path(project, integration))
+ expect(subject).to redirect_to(edit_project_integration_path(project, integration))
end
it 'renders a 404 if the hook does not exist' do
diff --git a/spec/controllers/projects/services_controller_spec.rb b/spec/controllers/projects/services_controller_spec.rb
index 29988da6e60..f3c7b501faa 100644
--- a/spec/controllers/projects/services_controller_spec.rb
+++ b/spec/controllers/projects/services_controller_spec.rb
@@ -183,7 +183,7 @@ RSpec.describe Projects::ServicesController do
let(:params) { project_params(service: integration_params) }
let(:message) { 'Jira settings saved and active.' }
- let(:redirect_url) { edit_project_service_path(project, integration) }
+ let(:redirect_url) { edit_project_integration_path(project, integration) }
before do
stub_jira_integration_test
@@ -341,7 +341,7 @@ RSpec.describe Projects::ServicesController do
it 'redirects user back to edit page with alert' do
put :update, params: project_params.merge(service: integration_params)
- expect(response).to redirect_to(edit_project_service_path(project, integration))
+ expect(response).to redirect_to(edit_project_integration_path(project, integration))
expected_alert = [
"You can now manage your Prometheus settings on the",
%(<a href="#{project_settings_operations_path(project)}">Operations</a> page.),
diff --git a/spec/controllers/projects/settings/access_tokens_controller_spec.rb b/spec/controllers/projects/settings/access_tokens_controller_spec.rb
deleted file mode 100644
index 834a9e276f9..00000000000
--- a/spec/controllers/projects/settings/access_tokens_controller_spec.rb
+++ /dev/null
@@ -1,82 +0,0 @@
-# frozen_string_literal: true
-
-require('spec_helper')
-
-RSpec.describe Projects::Settings::AccessTokensController do
- let_it_be(:user) { create(:user) }
- let_it_be(:group) { create(:group) }
- let_it_be(:project) { create(:project, group: group) }
- let_it_be(:bot_user) { create(:user, :project_bot) }
-
- before_all do
- project.add_maintainer(user)
- project.add_maintainer(bot_user)
- end
-
- before do
- sign_in(user)
- end
-
- shared_examples 'feature unavailable' do
- context 'user is not a maintainer' do
- before do
- project.add_developer(user)
- end
-
- it { is_expected.to have_gitlab_http_status(:not_found) }
- end
- end
-
- describe '#index' do
- subject { get :index, params: { namespace_id: project.namespace, project_id: project } }
-
- it_behaves_like 'feature unavailable'
- it_behaves_like 'project access tokens available #index'
- end
-
- describe '#create' do
- let(:access_token_params) { { name: 'Nerd bot', scopes: ["api"], expires_at: Date.today + 1.month } }
-
- subject { post :create, params: { namespace_id: project.namespace, project_id: project }.merge(project_access_token: access_token_params) }
-
- it_behaves_like 'feature unavailable'
- it_behaves_like 'project access tokens available #create'
-
- context 'when project access token creation is disabled' do
- before do
- group.namespace_settings.update_column(:resource_access_token_creation_allowed, false)
- end
-
- it { is_expected.to have_gitlab_http_status(:not_found) }
-
- it 'does not create the token' do
- expect { subject }.not_to change { PersonalAccessToken.count }
- end
-
- it 'does not add the project bot as a member' do
- expect { subject }.not_to change { Member.count }
- end
-
- it 'does not create the project bot user' do
- expect { subject }.not_to change { User.count }
- end
- end
-
- context 'with custom access level' do
- let(:access_token_params) { { name: 'Nerd bot', scopes: ["api"], expires_at: Date.today + 1.month, access_level: 20 } }
-
- subject { post :create, params: { namespace_id: project.namespace, project_id: project }.merge(project_access_token: access_token_params) }
-
- it_behaves_like 'project access tokens available #create'
- end
- end
-
- describe '#revoke', :sidekiq_inline do
- let(:project_access_token) { create(:personal_access_token, user: bot_user) }
-
- subject { put :revoke, params: { namespace_id: project.namespace, project_id: project, id: project_access_token } }
-
- it_behaves_like 'feature unavailable'
- it_behaves_like 'project access tokens available #revoke'
- end
-end
diff --git a/spec/controllers/projects/settings/ci_cd_controller_spec.rb b/spec/controllers/projects/settings/ci_cd_controller_spec.rb
index d50f1aa1dd8..7e96e99640a 100644
--- a/spec/controllers/projects/settings/ci_cd_controller_spec.rb
+++ b/spec/controllers/projects/settings/ci_cd_controller_spec.rb
@@ -25,6 +25,19 @@ RSpec.describe Projects::Settings::CiCdController do
expect(response).to render_template(:show)
end
+ context 'when the FF ci_owned_runners_cross_joins_fix is disabled' do
+ before do
+ stub_feature_flags(ci_owned_runners_cross_joins_fix: false)
+ end
+
+ it 'renders show with 200 status code' do
+ get :show, params: { namespace_id: project.namespace, project_id: project }
+
+ expect(response).to have_gitlab_http_status(:ok)
+ expect(response).to render_template(:show)
+ end
+ end
+
context 'with CI/CD disabled' do
before do
project.project_feature.update_attribute(:builds_access_level, ProjectFeature::DISABLED)