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
3942c095
Commit
3942c095
authored
Oct 14, 2019
by
Nick Kipling
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added check for sort param and spacing in tests
parent
e37cb267
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
1 deletion
+21
-1
ee/app/controllers/groups/packages_controller.rb
ee/app/controllers/groups/packages_controller.rb
+9
-1
ee/spec/features/groups/packages_spec.rb
ee/spec/features/groups/packages_spec.rb
+12
-0
No files found.
ee/app/controllers/groups/packages_controller.rb
View file @
3942c095
...
...
@@ -7,14 +7,22 @@ module Groups
before_action
:verify_packages_enabled!
def
index
@sort
=
sort_value
@packages
=
::
Packages
::
GroupPackagesFinder
.
new
(
current_user
,
group
)
.
execute
.
sort_by_attribute
(
@sort
=
params
[
:sort
]
||
sort_value_recently_created
)
.
sort_by_attribute
(
@sort
)
.
page
(
params
[
:page
])
end
private
def
sort_value
return
params
[
:sort
]
if
packages_sort_options_hash
.
key?
(
params
[
:sort
])
sort_value_recently_created
end
def
verify_packages_enabled!
render_404
unless
group
.
packages_feature_available?
end
...
...
ee/spec/features/groups/packages_spec.rb
View file @
3942c095
...
...
@@ -79,6 +79,7 @@ describe 'Group Packages' do
it
'sorts by created date descending by default'
do
visit
group_packages_path
(
group
)
expect
(
sort_dropdown_button_text
).
to
eq
(
sort_title_created_date
)
expect
(
first_package
).
to
include
(
bbb_package
.
name
)
expect
(
last_package
).
to
include
(
aaa_package
.
name
)
...
...
@@ -86,6 +87,7 @@ describe 'Group Packages' do
it
'handles an invalid param'
do
visit
group_packages_path
(
group
,
sort:
'garbage'
)
# bad sort param
expect
(
sort_dropdown_button_text
).
to
eq
(
sort_title_created_date
)
expect
(
first_package
).
to
include
(
bbb_package
.
name
)
expect
(
last_package
).
to
include
(
aaa_package
.
name
)
...
...
@@ -93,6 +95,7 @@ describe 'Group Packages' do
it
'sorts by created date descending'
do
visit
group_packages_path
(
group
,
sort:
sort_value_recently_created
)
expect
(
sort_dropdown_button_text
).
to
eq
(
sort_title_created_date
)
expect
(
first_package
).
to
include
(
bbb_package
.
name
)
expect
(
last_package
).
to
include
(
aaa_package
.
name
)
...
...
@@ -100,6 +103,7 @@ describe 'Group Packages' do
it
'sorts by created date ascending'
do
visit
group_packages_path
(
group
,
sort:
sort_value_oldest_created
)
expect
(
sort_dropdown_button_text
).
to
eq
(
sort_title_created_date
)
expect
(
first_package
).
to
include
(
aaa_package
.
name
)
expect
(
last_package
).
to
include
(
bbb_package
.
name
)
...
...
@@ -107,6 +111,7 @@ describe 'Group Packages' do
it
'sorts by name descending'
do
visit
group_packages_path
(
group
,
sort:
sort_value_name_desc
)
expect
(
sort_dropdown_button_text
).
to
eq
(
sort_title_name
)
expect
(
first_package
).
to
include
(
bbb_package
.
name
)
expect
(
last_package
).
to
include
(
aaa_package
.
name
)
...
...
@@ -114,6 +119,7 @@ describe 'Group Packages' do
it
'sorts by name ascending'
do
visit
group_packages_path
(
group
,
sort:
sort_value_name
)
expect
(
sort_dropdown_button_text
).
to
eq
(
sort_title_name
)
expect
(
first_package
).
to
include
(
aaa_package
.
name
)
expect
(
last_package
).
to
include
(
bbb_package
.
name
)
...
...
@@ -121,6 +127,7 @@ describe 'Group Packages' do
it
'sorts by version descending'
do
visit
group_packages_path
(
group
,
sort:
sort_value_version_desc
)
expect
(
sort_dropdown_button_text
).
to
eq
(
sort_title_version
)
expect
(
first_package
).
to
include
(
bbb_package
.
name
)
expect
(
last_package
).
to
include
(
aaa_package
.
name
)
...
...
@@ -128,6 +135,7 @@ describe 'Group Packages' do
it
'sorts by version ascending'
do
visit
group_packages_path
(
group
,
sort:
sort_value_version_asc
)
expect
(
sort_dropdown_button_text
).
to
eq
(
sort_title_version
)
expect
(
first_package
).
to
include
(
aaa_package
.
name
)
expect
(
last_package
).
to
include
(
bbb_package
.
name
)
...
...
@@ -135,6 +143,7 @@ describe 'Group Packages' do
it
'sorts by project descending'
do
visit
group_packages_path
(
group
,
sort:
sort_value_project_name_desc
)
expect
(
sort_dropdown_button_text
).
to
eq
(
sort_title_project_name
)
expect
(
first_package
).
to
include
(
bbb_package
.
name
)
expect
(
last_package
).
to
include
(
aaa_package
.
name
)
...
...
@@ -142,6 +151,7 @@ describe 'Group Packages' do
it
'sorts by project ascending'
do
visit
group_packages_path
(
group
,
sort:
sort_value_project_name_asc
)
expect
(
sort_dropdown_button_text
).
to
eq
(
sort_title_project_name
)
expect
(
first_package
).
to
include
(
aaa_package
.
name
)
expect
(
last_package
).
to
include
(
bbb_package
.
name
)
...
...
@@ -154,6 +164,7 @@ describe 'Group Packages' do
it
'sorts by type descending'
do
visit
group_packages_path
(
group
,
sort:
sort_value_type_desc
)
expect
(
sort_dropdown_button_text
).
to
eq
(
sort_title_type
)
expect
(
first_package
).
to
include
(
npm_package
.
name
)
expect
(
last_package
).
to
include
(
maven_package
.
name
)
...
...
@@ -161,6 +172,7 @@ describe 'Group Packages' do
it
'sorts by type ascending'
do
visit
group_packages_path
(
group
,
sort:
sort_value_type_asc
)
expect
(
sort_dropdown_button_text
).
to
eq
(
sort_title_type
)
expect
(
first_package
).
to
include
(
maven_package
.
name
)
expect
(
last_package
).
to
include
(
npm_package
.
name
)
...
...
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