Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
4f5ccf9a
Commit
4f5ccf9a
authored
Jan 12, 2022
by
Nicolò Maria Mezzopera
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove unused package_details_data
- source - tests
parent
7f71dcb5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
0 additions
and
61 deletions
+0
-61
app/helpers/packages_helper.rb
app/helpers/packages_helper.rb
+0
-20
spec/helpers/packages_helper_spec.rb
spec/helpers/packages_helper_spec.rb
+0
-41
No files found.
app/helpers/packages_helper.rb
View file @
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
spec/helpers/packages_helper_spec.rb
View file @
4f5ccf9a
...
...
@@ -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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment