Commit 30ba441f authored by Douglas Barbosa Alexandre's avatar Douglas Barbosa Alexandre

Merge branch 'sh-fix-project-deletion-warning-name' into 'master'

Fix incorrect project path warning after failed project path rename

See merge request gitlab-org/gitlab!40422
parents cb6244c1 f841efb8
......@@ -98,6 +98,7 @@ class ProjectsController < Projects::ApplicationController
end
else
flash.now[:alert] = result[:message]
@project.reset
format.html { render_edit }
end
......
---
title: Fix incorrect project path warning after failed project path rename
merge_request: 40422
author:
type: fixed
......@@ -555,6 +555,18 @@ RSpec.describe ProjectsController do
end
shared_examples_for 'updating a project' do
context 'when there is a conflicting project path' do
let(:random_name) { "project-#{SecureRandom.hex(8)}" }
let!(:conflict_project) { create(:project, name: random_name, path: random_name, namespace: project.namespace) }
it 'does not show any references to the conflicting path' do
expect { update_project(path: random_name) }.not_to change { project.reload.path }
expect(response).to have_gitlab_http_status(:ok)
expect(response.body).not_to include(random_name)
end
end
context 'when only renaming a project path' do
it "sets the repository to the right path after a rename" do
original_repository_path = Gitlab::GitalyClient::StorageSettings.allow_disk_access do
......
......@@ -37,7 +37,7 @@ RSpec.describe 'Projects > Settings > User renames a project' do
it 'shows errors for invalid project path' do
change_path(project, 'foo&bar')
expect(page).to have_field 'Path', with: 'foo&bar'
expect(page).to have_field 'Path', with: 'gitlab'
expect(page).to have_content "Path can contain only letters, digits, '_', '-' and '.'. Cannot start with '-', end in '.git' or end in '.atom'"
end
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment