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
d434bce5
Commit
d434bce5
authored
Jan 24, 2020
by
Giorgenes Gelatti
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor package specs
parent
26bf2b67
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
14 deletions
+14
-14
ee/spec/requests/api/project_packages_spec.rb
ee/spec/requests/api/project_packages_spec.rb
+14
-14
No files found.
ee/spec/requests/api/project_packages_spec.rb
View file @
d434bce5
...
@@ -7,7 +7,7 @@ describe API::ProjectPackages do
...
@@ -7,7 +7,7 @@ describe API::ProjectPackages do
let
(
:project
)
{
create
(
:project
,
:public
)
}
let
(
:project
)
{
create
(
:project
,
:public
)
}
let!
(
:package1
)
{
create
(
:npm_package
,
project:
project
,
version:
'3.1.0'
,
name:
"@
#{
project
.
root_namespace
.
path
}
/foo1"
)
}
let!
(
:package1
)
{
create
(
:npm_package
,
project:
project
,
version:
'3.1.0'
,
name:
"@
#{
project
.
root_namespace
.
path
}
/foo1"
)
}
let
(
:package_url
)
{
"/projects/
#{
project
.
id
}
/packages/
#{
package1
.
id
}
"
}
let
(
:package_url
)
{
"/projects/
#{
project
.
id
}
/packages/
#{
package1
.
id
}
"
}
let!
(
:package2
)
{
create
(
:n
pm_package
,
project:
project
,
version:
'2.0.4'
,
name:
"@
#{
project
.
root_namespace
.
path
}
/foo2"
)
}
let!
(
:package2
)
{
create
(
:n
uget_package
,
project:
project
,
version:
'2.0.4'
)
}
let!
(
:another_package
)
{
create
(
:npm_package
)
}
let!
(
:another_package
)
{
create
(
:npm_package
)
}
let
(
:no_package_url
)
{
"/projects/
#{
project
.
id
}
/packages/0"
}
let
(
:no_package_url
)
{
"/projects/
#{
project
.
id
}
/packages/0"
}
let
(
:wrong_package_url
)
{
"/projects/
#{
project
.
id
}
/packages/
#{
another_package
.
id
}
"
}
let
(
:wrong_package_url
)
{
"/projects/
#{
project
.
id
}
/packages/
#{
another_package
.
id
}
"
}
...
@@ -70,11 +70,9 @@ describe API::ProjectPackages do
...
@@ -70,11 +70,9 @@ describe API::ProjectPackages do
end
end
context
'with sorting'
do
context
'with sorting'
do
shared_examples
'package sorting'
do
|
order_by
,
package_names
|
shared_examples
'package sorting'
do
|
order_by
|
subject
{
get
api
(
url
),
params:
{
sort:
sort
,
order_by:
order_by
}
}
subject
{
get
api
(
url
),
params:
{
sort:
sort
,
order_by:
order_by
}
}
let
(
:packages
)
{
package_names
.
map
{
|
name
|
send
(
name
)
}
}
context
"sorting by
#{
order_by
}
"
do
context
"sorting by
#{
order_by
}
"
do
context
'ascending order'
do
context
'ascending order'
do
let
(
:sort
)
{
'asc'
}
let
(
:sort
)
{
'asc'
}
...
@@ -106,18 +104,20 @@ describe API::ProjectPackages do
...
@@ -106,18 +104,20 @@ describe API::ProjectPackages do
end
end
end
end
it_behaves_like
'package sorting'
,
'name'
,
[
:package1
,
:package2
,
:package3
]
it_behaves_like
'package sorting'
,
'name'
do
it_behaves_like
'package sorting'
,
'created_at'
,
[
:package3
,
:package1
,
:package2
]
let
(
:packages
)
{
[
package1
,
package2
,
package3
]
}
it_behaves_like
'package sorting'
,
'version'
,
[
:package3
,
:package2
,
:package1
]
end
context
'by packages type'
do
it_behaves_like
'package sorting'
,
'created_at'
do
before
do
let
(
:packages
)
{
[
package3
,
package1
,
package2
]
}
# get rid of extra npm package as it messes up
end
# the package type sorting test
package2
.
destroy
it_behaves_like
'package sorting'
,
'version'
do
end
let
(
:packages
)
{
[
package3
,
package2
,
package1
]
}
end
it_behaves_like
'package sorting'
,
'type'
,
[
:package3
,
:package1
]
it_behaves_like
'package sorting'
,
'type'
do
let
(
:packages
)
{
[
package3
,
package1
,
package2
]
}
end
end
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