Commit 76245086 authored by David Fernandez's avatar David Fernandez

Merge branch '347409-migrate-package-details-page-to-vue-router-5' into 'master'

Remove unused methods from packages_helper

See merge request gitlab-org/gitlab!78062
parents d0fe778b 4f5ccf9a
......@@ -55,24 +55,4 @@ module PackagesHelper
project.container_expiration_policy.nil? &&
project.container_repositories.exists?
end
def package_details_data(project, package)
{
package_id: package.id,
can_delete: can?(current_user, :destroy_package, project).to_s,
svg_path: image_path('illustrations/no-packages.svg'),
npm_path: package_registry_instance_url(:npm),
npm_project_path: package_registry_project_url(project.id, :npm),
maven_path: package_registry_project_url(project.id, :maven),
conan_path: package_registry_project_url(project.id, :conan),
nuget_path: nuget_package_registry_url(project.id),
pypi_path: pypi_registry_url(project.id),
pypi_setup_path: package_registry_project_url(project.id, :pypi),
composer_path: composer_registry_url(project&.group&.id),
project_name: project.name,
project_list_url: project_packages_path(project),
group_list_url: project.group ? group_packages_path(project.group) : '',
composer_config_repository_name: composer_config_repository_name(project.group&.id)
}
end
end
......@@ -219,45 +219,4 @@ RSpec.describe PackagesHelper do
it { is_expected.to eq(expected_result) }
end
end
describe '#package_details_data' do
let_it_be(:package) { create(:package) }
let(:expected_result) do
{
package_id: package.id,
can_delete: 'true',
project_name: project.name,
group_list_url: ''
}
end
before do
allow(helper).to receive(:current_user) { project.owner }
allow(helper).to receive(:can?) { true }
end
context 'in a project without a group' do
it 'populates presenter data' do
result = helper.package_details_data(project, package)
expect(result).to match(hash_including(expected_result))
end
end
context 'in a project with a group' do
let_it_be(:group) { create(:group) }
let_it_be(:project_with_group) { create(:project, group: group) }
it 'populates presenter data' do
result = helper.package_details_data(project_with_group, package)
expected = expected_result.merge({
group_list_url: group_packages_path(project_with_group.group),
project_name: project_with_group.name
})
expect(result).to match(hash_including(expected))
end
end
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