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
42d77f31
Commit
42d77f31
authored
Mar 18, 2021
by
Stan Hu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add specs for Maven and do some cleanup
parent
0b0c6188
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
15 deletions
+18
-15
spec/features/file_uploads/maven_package_spec.rb
spec/features/file_uploads/maven_package_spec.rb
+14
-7
spec/features/file_uploads/nuget_package_spec.rb
spec/features/file_uploads/nuget_package_spec.rb
+2
-2
spec/features/file_uploads/rubygem_package_spec.rb
spec/features/file_uploads/rubygem_package_spec.rb
+2
-6
No files found.
spec/features/file_uploads/maven_package_spec.rb
View file @
42d77f31
...
@@ -6,16 +6,17 @@ RSpec.describe 'Upload a maven package', :api, :js do
...
@@ -6,16 +6,17 @@ RSpec.describe 'Upload a maven package', :api, :js do
include_context
'file upload requests helpers'
include_context
'file upload requests helpers'
let_it_be
(
:project
)
{
create
(
:project
)
}
let_it_be
(
:project
)
{
create
(
:project
)
}
let_it_be
(
:user
)
{
create
(
:user
,
:admin
)
}
let_it_be
(
:user
)
{
project
.
owner
}
let_it_be
(
:personal_access_token
)
{
create
(
:personal_access_token
,
user:
user
)
}
let_it_be
(
:personal_access_token
)
{
create
(
:personal_access_token
,
user:
user
)
}
let
(
:api_path
)
{
"/projects/
#{
project
.
id
}
/packages/maven/com/example/my-app/1.0/my-app-1.0-20180724.124855-1.jar"
}
let
(
:project_id
)
{
project
.
id
}
let
(
:api_path
)
{
"/projects/
#{
project_id
}
/packages/maven/com/example/my-app/1.0/my-app-1.0-20180724.124855-1.jar"
}
let
(
:url
)
{
capybara_url
(
api
(
api_path
,
personal_access_token:
personal_access_token
))
}
let
(
:url
)
{
capybara_url
(
api
(
api_path
,
personal_access_token:
personal_access_token
))
}
let
(
:file
)
{
fixture_file_upload
(
'spec/fixtures/dk.png'
)
}
let
(
:file
)
{
fixture_file_upload
(
'spec/fixtures/dk.png'
)
}
subject
{
HTTParty
.
put
(
url
,
body:
file
.
read
)
}
subject
{
HTTParty
.
put
(
url
,
body:
file
.
read
)
}
RSpec
.
shared_examples
'for a maven package'
do
shared_examples
'for a maven package'
do
it
'creates package files'
do
it
'creates package files'
do
expect
{
subject
}
expect
{
subject
}
.
to
change
{
Packages
::
Package
.
maven
.
count
}.
by
(
1
)
.
to
change
{
Packages
::
Package
.
maven
.
count
}.
by
(
1
)
...
@@ -25,9 +26,9 @@ RSpec.describe 'Upload a maven package', :api, :js do
...
@@ -25,9 +26,9 @@ RSpec.describe 'Upload a maven package', :api, :js do
it
{
expect
(
subject
.
code
).
to
eq
(
200
)
}
it
{
expect
(
subject
.
code
).
to
eq
(
200
)
}
end
end
RSpec
.
shared_examples
'for a maven sha1'
do
shared_examples
'for a maven sha1'
do
let
(
:dummy_package
)
{
double
(
Packages
::
Package
)
}
let
(
:dummy_package
)
{
double
(
Packages
::
Package
)
}
let
(
:api_path
)
{
"/projects/
#{
project
.
id
}
/packages/maven/com/example/my-app/1.0/my-app-1.0-20180724.124855-1.jar.sha1"
}
let
(
:api_path
)
{
"/projects/
#{
project
_
id
}
/packages/maven/com/example/my-app/1.0/my-app-1.0-20180724.124855-1.jar.sha1"
}
before
do
before
do
# The sha verification done by the maven api is between:
# The sha verification done by the maven api is between:
...
@@ -42,8 +43,8 @@ RSpec.describe 'Upload a maven package', :api, :js do
...
@@ -42,8 +43,8 @@ RSpec.describe 'Upload a maven package', :api, :js do
it
{
expect
(
subject
.
code
).
to
eq
(
204
)
}
it
{
expect
(
subject
.
code
).
to
eq
(
204
)
}
end
end
RSpec
.
shared_examples
'for a maven md5'
do
shared_examples
'for a maven md5'
do
let
(
:api_path
)
{
"/projects/
#{
project
.
id
}
/packages/maven/com/example/my-app/1.0/my-app-1.0-20180724.124855-1.jar.md5"
}
let
(
:api_path
)
{
"/projects/
#{
project
_
id
}
/packages/maven/com/example/my-app/1.0/my-app-1.0-20180724.124855-1.jar.md5"
}
let
(
:file
)
{
StringIO
.
new
(
'dummy_package'
)
}
let
(
:file
)
{
StringIO
.
new
(
'dummy_package'
)
}
it
{
expect
(
subject
.
code
).
to
eq
(
200
)
}
it
{
expect
(
subject
.
code
).
to
eq
(
200
)
}
...
@@ -52,4 +53,10 @@ RSpec.describe 'Upload a maven package', :api, :js do
...
@@ -52,4 +53,10 @@ RSpec.describe 'Upload a maven package', :api, :js do
it_behaves_like
'handling file uploads'
,
'for a maven package'
it_behaves_like
'handling file uploads'
,
'for a maven package'
it_behaves_like
'handling file uploads'
,
'for a maven sha1'
it_behaves_like
'handling file uploads'
,
'for a maven sha1'
it_behaves_like
'handling file uploads'
,
'for a maven md5'
it_behaves_like
'handling file uploads'
,
'for a maven md5'
context
'with an encoded project ID'
do
let
(
:project_id
)
{
"
#{
project
.
namespace
.
path
}
%2F
#{
project
.
path
}
"
}
it_behaves_like
'handling file uploads'
,
'for a maven package'
end
end
end
spec/features/file_uploads/nuget_package_spec.rb
View file @
42d77f31
...
@@ -6,7 +6,7 @@ RSpec.describe 'Upload a nuget package', :api, :js do
...
@@ -6,7 +6,7 @@ RSpec.describe 'Upload a nuget package', :api, :js do
include_context
'file upload requests helpers'
include_context
'file upload requests helpers'
let_it_be
(
:project
)
{
create
(
:project
)
}
let_it_be
(
:project
)
{
create
(
:project
)
}
let_it_be
(
:user
)
{
create
(
:user
,
:admin
)
}
let_it_be
(
:user
)
{
project
.
owner
}
let_it_be
(
:personal_access_token
)
{
create
(
:personal_access_token
,
user:
user
)
}
let_it_be
(
:personal_access_token
)
{
create
(
:personal_access_token
,
user:
user
)
}
let
(
:api_path
)
{
"/projects/
#{
project
.
id
}
/packages/nuget/"
}
let
(
:api_path
)
{
"/projects/
#{
project
.
id
}
/packages/nuget/"
}
...
@@ -21,7 +21,7 @@ RSpec.describe 'Upload a nuget package', :api, :js do
...
@@ -21,7 +21,7 @@ RSpec.describe 'Upload a nuget package', :api, :js do
)
)
end
end
RSpec
.
shared_examples
'for a nuget package'
do
shared_examples
'for a nuget package'
do
it
'creates package files'
do
it
'creates package files'
do
expect
{
subject
}
expect
{
subject
}
.
to
change
{
Packages
::
Package
.
nuget
.
count
}.
by
(
1
)
.
to
change
{
Packages
::
Package
.
nuget
.
count
}.
by
(
1
)
...
...
spec/features/file_uploads/rubygem_package_spec.rb
View file @
42d77f31
...
@@ -6,7 +6,7 @@ RSpec.describe 'Upload a RubyGems package', :api, :js do
...
@@ -6,7 +6,7 @@ RSpec.describe 'Upload a RubyGems package', :api, :js do
include_context
'file upload requests helpers'
include_context
'file upload requests helpers'
let_it_be
(
:project
)
{
create
(
:project
)
}
let_it_be
(
:project
)
{
create
(
:project
)
}
let_it_be
(
:user
)
{
create
(
:user
)
}
let_it_be
(
:user
)
{
project
.
owner
}
let_it_be
(
:personal_access_token
)
{
create
(
:personal_access_token
,
user:
user
)
}
let_it_be
(
:personal_access_token
)
{
create
(
:personal_access_token
,
user:
user
)
}
let
(
:api_path
)
{
"/projects/
#{
project_id
}
/packages/rubygems/api/v1/gems"
}
let
(
:api_path
)
{
"/projects/
#{
project_id
}
/packages/rubygems/api/v1/gems"
}
...
@@ -21,11 +21,7 @@ RSpec.describe 'Upload a RubyGems package', :api, :js do
...
@@ -21,11 +21,7 @@ RSpec.describe 'Upload a RubyGems package', :api, :js do
)
)
end
end
before
do
shared_examples
'for a Rubygems package'
do
project
.
add_maintainer
(
user
)
end
RSpec
.
shared_examples
'for a Rubygems package'
do
it
'creates package files'
do
it
'creates package files'
do
expect
{
subject
}
expect
{
subject
}
.
to
change
{
Packages
::
Package
.
rubygems
.
count
}.
by
(
1
)
.
to
change
{
Packages
::
Package
.
rubygems
.
count
}.
by
(
1
)
...
...
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