Replace deprecated path_with_namespace with full_path

Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
This commit is contained in:
Dmitriy Zaporozhets 2018-03-05 15:41:54 +02:00
parent 8a0052c037
commit 86df5c6793
No known key found for this signature in database
GPG key ID: 627C5F589F467F17
8 changed files with 27 additions and 23 deletions

View file

@ -4,16 +4,16 @@ module ImportHelper
"#{namespace}/#{name}"
end
def provider_project_link(provider, path_with_namespace)
url = __send__("#{provider}_project_url", path_with_namespace) # rubocop:disable GitlabSecurity/PublicSend
def provider_project_link(provider, full_path)
url = __send__("#{provider}_project_url", full_path) # rubocop:disable GitlabSecurity/PublicSend
link_to path_with_namespace, url, target: '_blank', rel: 'noopener noreferrer'
link_to full_path, url, target: '_blank', rel: 'noopener noreferrer'
end
private
def github_project_url(path_with_namespace)
"#{github_root_url}/#{path_with_namespace}"
def github_project_url(full_path)
"#{github_root_url}/#{full_path}"
end
def github_root_url
@ -23,7 +23,7 @@ module ImportHelper
@github_url = provider.fetch('url', 'https://github.com') if provider
end
def gitea_project_url(path_with_namespace)
"#{@gitea_host_url.sub(%r{/+\z}, '')}/#{path_with_namespace}"
def gitea_project_url(full_path)
"#{@gitea_host_url.sub(%r{/+\z}, '')}/#{full_path}"
end
end

View file

@ -22,7 +22,7 @@ module Gitlab
importer_class.new(object, project, client).execute
counter.increment(project: project.path_with_namespace)
counter.increment(project: project.full_path)
end
def counter

View file

@ -16,7 +16,7 @@ module Gitlab
def report_import_time(project)
duration = Time.zone.now - project.created_at
path = project.path_with_namespace
path = project.full_path
histogram.observe({ project: path }, duration)
counter.increment

View file

@ -84,7 +84,7 @@ RSpec.describe 'Dashboard Issues' do
wait_for_requests
project_path = "/#{project.path_with_namespace}"
project_path = "/#{project.full_path}"
project_json = { name: project.name_with_namespace, url: project_path }.to_json
# simulate selection, and prevent overlap by dropdown menu

View file

@ -14,13 +14,13 @@ describe ProjectWiki do
it { is_expected.to delegate_method(:repository_storage_path).to :project }
it { is_expected.to delegate_method(:hashed_storage?).to :project }
describe "#path_with_namespace" do
describe "#full_path" do
it "returns the project path with namespace with the .wiki extension" do
expect(subject.path_with_namespace).to eq(project.full_path + '.wiki')
expect(subject.full_path).to eq(project.full_path + '.wiki')
end
it 'returns the same value as #full_path' do
expect(subject.path_with_namespace).to eq(subject.full_path)
expect(subject.full_path).to eq(subject.full_path)
end
end

View file

@ -16,7 +16,7 @@ describe API::PagesDomains do
let(:route) { "/projects/#{project.id}/pages/domains" }
let(:route_domain) { "/projects/#{project.id}/pages/domains/#{pages_domain.domain}" }
let(:route_domain_path) { "/projects/#{project.path_with_namespace.gsub('/', '%2F')}/pages/domains/#{pages_domain.domain}" }
let(:route_domain_path) { "/projects/#{project.full_path.gsub('/', '%2F')}/pages/domains/#{pages_domain.domain}" }
let(:route_secure_domain) { "/projects/#{project.id}/pages/domains/#{pages_domain_secure.domain}" }
let(:route_expired_domain) { "/projects/#{project.id}/pages/domains/#{pages_domain_expired.domain}" }
let(:route_vacant_domain) { "/projects/#{project.id}/pages/domains/www.vacant-domain.test" }

View file

@ -172,7 +172,7 @@ describe Auth::ContainerRegistryAuthenticationService do
end
let(:current_params) do
{ scope: "repository:#{project.path_with_namespace}:*" }
{ scope: "repository:#{project.full_path}:*" }
end
it_behaves_like 'an inaccessible'
@ -200,7 +200,7 @@ describe Auth::ContainerRegistryAuthenticationService do
end
let(:current_params) do
{ scope: "repository:#{project.path_with_namespace}:*" }
{ scope: "repository:#{project.full_path}:*" }
end
it_behaves_like 'an inaccessible'
@ -239,7 +239,7 @@ describe Auth::ContainerRegistryAuthenticationService do
end
let(:current_params) do
{ scope: "repository:#{project.path_with_namespace}:*" }
{ scope: "repository:#{project.full_path}:*" }
end
it_behaves_like 'an inaccessible'
@ -270,7 +270,7 @@ describe Auth::ContainerRegistryAuthenticationService do
context 'disallow anyone to delete images' do
let(:current_params) do
{ scope: "repository:#{project.path_with_namespace}:*" }
{ scope: "repository:#{project.full_path}:*" }
end
it_behaves_like 'an inaccessible'
@ -311,7 +311,7 @@ describe Auth::ContainerRegistryAuthenticationService do
context 'disallow anyone to delete images' do
let(:current_params) do
{ scope: "repository:#{project.path_with_namespace}:*" }
{ scope: "repository:#{project.full_path}:*" }
end
it_behaves_like 'an inaccessible'
@ -323,7 +323,7 @@ describe Auth::ContainerRegistryAuthenticationService do
context 'disallow anyone to pull or push images' do
let(:current_user) { create(:user, external: true) }
let(:current_params) do
{ scope: "repository:#{project.path_with_namespace}:pull,push" }
{ scope: "repository:#{project.full_path}:pull,push" }
end
it_behaves_like 'an inaccessible'
@ -333,7 +333,7 @@ describe Auth::ContainerRegistryAuthenticationService do
context 'disallow anyone to delete images' do
let(:current_user) { create(:user, external: true) }
let(:current_params) do
{ scope: "repository:#{project.path_with_namespace}:*" }
{ scope: "repository:#{project.full_path}:*" }
end
it_behaves_like 'an inaccessible'
@ -359,7 +359,7 @@ describe Auth::ContainerRegistryAuthenticationService do
context 'allow to delete images' do
let(:current_params) do
{ scope: "repository:#{current_project.path_with_namespace}:*" }
{ scope: "repository:#{current_project.full_path}:*" }
end
it_behaves_like 'a deletable' do
@ -398,7 +398,7 @@ describe Auth::ContainerRegistryAuthenticationService do
context 'disallow to delete images' do
let(:current_params) do
{ scope: "repository:#{current_project.path_with_namespace}:*" }
{ scope: "repository:#{current_project.full_path}:*" }
end
it_behaves_like 'an inaccessible' do

View file

@ -30,6 +30,7 @@ describe SystemHooksService do
:old_path_with_namespace
)
end
it do
project.old_path_with_namespace = 'transfered_from_path'
expect(event_data(project, :transfer)).to include(
@ -45,18 +46,21 @@ describe SystemHooksService do
:owner_name, :owner_email
)
end
it do
expect(event_data(group, :destroy)).to include(
:event_name, :name, :created_at, :updated_at, :path, :group_id,
:owner_name, :owner_email
)
end
it do
expect(event_data(group_member, :create)).to include(
:event_name, :created_at, :updated_at, :group_name, :group_path,
:group_id, :user_id, :user_username, :user_name, :user_email, :group_access
)
end
it do
expect(event_data(group_member, :destroy)).to include(
:event_name, :created_at, :updated_at, :group_name, :group_path,