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
3be37175
Commit
3be37175
authored
Dec 25, 2018
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Dry npm_packages_spec a bit
Signed-off-by:
Dmitriy Zaporozhets
<
dmitriy.zaporozhets@gmail.com
>
parent
5c68f074
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
36 deletions
+21
-36
ee/spec/requests/api/npm_packages_spec.rb
ee/spec/requests/api/npm_packages_spec.rb
+21
-36
No files found.
ee/spec/requests/api/npm_packages_spec.rb
View file @
3be37175
...
...
@@ -150,24 +150,7 @@ describe API::NpmPackages do
describe
'PUT /api/v4/projects/:id/packages/npm/:package_name'
do
context
'when params are correct'
do
context
'unscoped package'
do
let
(
:params
)
do
{
name:
'foo'
,
versions:
{
'1.0.1'
=>
{
dist:
{
shasum:
'f572d396fae9206628714fb2ce00f72e94f2258f'
}
}
},
'_attachments'
=>
{
"foo-1.0.1.tgz"
=>
{
'data'
=>
'aGVsbG8K'
,
'length'
=>
8
}
}
}
end
let
(
:params
)
{
upload_params
(
'foo'
)
}
it
'creates npm package with file'
do
expect
{
upload_package_with_token
(
'foo'
,
params
)
}
...
...
@@ -179,24 +162,7 @@ describe API::NpmPackages do
end
context
'scoped package'
do
let
(
:params
)
do
{
name:
'@bar/foo'
,
versions:
{
'1.0.1'
=>
{
dist:
{
shasum:
'f572d396fae9206628714fb2ce00f72e94f2258f'
}
}
},
'_attachments'
=>
{
"@bar/foo-1.0.1.tgz"
=>
{
'data'
=>
'aGVsbG8K'
,
'length'
=>
8
}
}
}
end
let
(
:params
)
{
upload_params
(
'@foo/bar'
)
}
it
'creates npm package with file'
do
expect
{
upload_package_with_token
(
'@bar%2Ffoo'
,
params
)
}
...
...
@@ -215,6 +181,25 @@ describe API::NpmPackages do
def
upload_package_with_token
(
package_name
,
params
=
{})
upload_package
(
package_name
,
params
.
merge
(
access_token:
token
.
token
))
end
def
upload_params
(
package_name
)
{
name:
package_name
,
versions:
{
'1.0.1'
=>
{
dist:
{
shasum:
'f572d396fae9206628714fb2ce00f72e94f2258f'
}
}
},
'_attachments'
=>
{
"
#{
package_name
}
-1.0.1.tgz"
=>
{
'data'
=>
'aGVsbG8K'
,
'length'
=>
8
}
}
}
end
end
def
expect_a_valid_package_response
...
...
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