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
475dc256
Commit
475dc256
authored
Aug 03, 2020
by
Giorgenes Gelatti
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adds urls to package presenter
Adds pipeline_url and commit_url to package detail presenter
parent
d9983961
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
3 deletions
+13
-3
app/presenters/packages/detail/package_presenter.rb
app/presenters/packages/detail/package_presenter.rb
+3
-1
spec/presenters/packages/detail/package_presenter_spec.rb
spec/presenters/packages/detail/package_presenter_spec.rb
+10
-2
No files found.
app/presenters/packages/detail/package_presenter.rb
View file @
475dc256
...
@@ -49,7 +49,9 @@ module Packages
...
@@ -49,7 +49,9 @@ module Packages
user:
build_user_info
(
pipeline_info
.
user
),
user:
build_user_info
(
pipeline_info
.
user
),
project:
{
project:
{
name:
pipeline_info
.
project
.
name
,
name:
pipeline_info
.
project
.
name
,
web_url:
pipeline_info
.
project
.
web_url
web_url:
pipeline_info
.
project
.
web_url
,
pipeline_url:
Gitlab
::
Routing
.
url_helpers
.
project_pipeline_url
(
pipeline_info
.
project
,
pipeline_info
),
commit_url:
Gitlab
::
Routing
.
url_helpers
.
project_commit_url
(
pipeline_info
.
project
,
pipeline_info
.
sha
)
}
}
}
}
end
end
...
...
spec/presenters/packages/detail/package_presenter_spec.rb
View file @
475dc256
...
@@ -9,6 +9,7 @@ RSpec.describe ::Packages::Detail::PackagePresenter do
...
@@ -9,6 +9,7 @@ RSpec.describe ::Packages::Detail::PackagePresenter do
let
(
:presenter
)
{
described_class
.
new
(
package
)
}
let
(
:presenter
)
{
described_class
.
new
(
package
)
}
let_it_be
(
:user_info
)
{
{
name:
user
.
name
,
avatar_url:
user
.
avatar_url
}
}
let_it_be
(
:user_info
)
{
{
name:
user
.
name
,
avatar_url:
user
.
avatar_url
}
}
let!
(
:expected_package_files
)
do
let!
(
:expected_package_files
)
do
npm_file
=
package
.
package_files
.
first
npm_file
=
package
.
package_files
.
first
[{
[{
...
@@ -18,6 +19,7 @@ RSpec.describe ::Packages::Detail::PackagePresenter do
...
@@ -18,6 +19,7 @@ RSpec.describe ::Packages::Detail::PackagePresenter do
size:
npm_file
.
size
size:
npm_file
.
size
}]
}]
end
end
let
(
:pipeline_info
)
do
let
(
:pipeline_info
)
do
pipeline
=
package
.
build_info
.
pipeline
pipeline
=
package
.
build_info
.
pipeline
{
{
...
@@ -29,11 +31,15 @@ RSpec.describe ::Packages::Detail::PackagePresenter do
...
@@ -29,11 +31,15 @@ RSpec.describe ::Packages::Detail::PackagePresenter do
user:
user_info
,
user:
user_info
,
project:
{
project:
{
name:
pipeline
.
project
.
name
,
name:
pipeline
.
project
.
name
,
web_url:
pipeline
.
project
.
web_url
web_url:
pipeline
.
project
.
web_url
,
pipeline_url:
include
(
"pipelines/
#{
pipeline
.
id
}
"
),
commit_url:
include
(
"commit/
#{
pipeline
.
sha
}
"
)
}
}
}
}
end
end
let!
(
:dependency_links
)
{
[]
}
let!
(
:dependency_links
)
{
[]
}
let!
(
:expected_package_details
)
do
let!
(
:expected_package_details
)
do
{
{
id:
package
.
id
,
id:
package
.
id
,
...
@@ -55,7 +61,7 @@ RSpec.describe ::Packages::Detail::PackagePresenter do
...
@@ -55,7 +61,7 @@ RSpec.describe ::Packages::Detail::PackagePresenter do
let
(
:expected_package_details
)
{
super
().
merge
(
pipeline:
pipeline_info
)
}
let
(
:expected_package_details
)
{
super
().
merge
(
pipeline:
pipeline_info
)
}
it
'returns details with pipeline'
do
it
'returns details with pipeline'
do
expect
(
presenter
.
detail_view
).
to
eq
expected_package_details
expect
(
presenter
.
detail_view
).
to
match
expected_package_details
end
end
end
end
...
@@ -81,6 +87,7 @@ RSpec.describe ::Packages::Detail::PackagePresenter do
...
@@ -81,6 +87,7 @@ RSpec.describe ::Packages::Detail::PackagePresenter do
let_it_be
(
:package
)
{
create
(
:nuget_package
,
project:
project
)
}
let_it_be
(
:package
)
{
create
(
:nuget_package
,
project:
project
)
}
let_it_be
(
:dependency_link
)
{
create
(
:packages_dependency_link
,
package:
package
)
}
let_it_be
(
:dependency_link
)
{
create
(
:packages_dependency_link
,
package:
package
)
}
let_it_be
(
:nuget_dependency
)
{
create
(
:nuget_dependency_link_metadatum
,
dependency_link:
dependency_link
)
}
let_it_be
(
:nuget_dependency
)
{
create
(
:nuget_dependency_link_metadatum
,
dependency_link:
dependency_link
)
}
let_it_be
(
:expected_link
)
do
let_it_be
(
:expected_link
)
do
{
{
name:
dependency_link
.
dependency
.
name
,
name:
dependency_link
.
dependency
.
name
,
...
@@ -88,6 +95,7 @@ RSpec.describe ::Packages::Detail::PackagePresenter do
...
@@ -88,6 +95,7 @@ RSpec.describe ::Packages::Detail::PackagePresenter do
target_framework:
nuget_dependency
.
target_framework
target_framework:
nuget_dependency
.
target_framework
}
}
end
end
let_it_be
(
:dependency_links
)
{
[
expected_link
]
}
let_it_be
(
:dependency_links
)
{
[
expected_link
]
}
it
'returns the correct dependency link'
do
it
'returns the correct dependency link'
do
...
...
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