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
d77379fb
Commit
d77379fb
authored
Oct 23, 2020
by
Michał Zając
Committed by
Mark Florian
Oct 26, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add basic specs
parent
f69a53ef
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
57 additions
and
0 deletions
+57
-0
ee/spec/controllers/projects/security/vulnerability_report_controller_spec.rb
...projects/security/vulnerability_report_controller_spec.rb
+57
-0
No files found.
ee/spec/controllers/projects/security/vulnerability_report_controller_spec.rb
0 → 100644
View file @
d77379fb
# frozen_string_literal: true
require
'spec_helper'
RSpec
.
describe
Projects
::
Security
::
VulnerabilityReportController
do
let_it_be
(
:group
)
{
create
(
:group
)
}
let_it_be
(
:project
)
{
create
(
:project
,
:repository
,
:public
,
namespace:
group
)
}
let_it_be
(
:user
)
{
create
(
:user
)
}
it_behaves_like
SecurityDashboardsPermissions
do
let
(
:vulnerable
)
{
project
}
let
(
:security_dashboard_action
)
do
get
:index
,
params:
{
namespace_id:
project
.
namespace
,
project_id:
project
}
end
end
before
do
group
.
add_developer
(
user
)
stub_licensed_features
(
security_dashboard:
true
)
end
describe
'GET #index'
do
let
(
:pipeline
)
{
create
(
:ci_pipeline
,
sha:
project
.
commit
.
id
,
project:
project
,
user:
user
)
}
render_views
def
show_security_dashboard
(
current_user
=
user
)
sign_in
(
current_user
)
get
:index
,
params:
{
namespace_id:
project
.
namespace
,
project_id:
project
}
end
context
'when project has no vulnerabilities'
do
it
'renders empty state'
do
show_security_dashboard
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
response
).
to
render_template
(
:index
)
expect
(
response
.
body
).
to
have_css
(
'div#js-security-report-app[data-has-vulnerabilities="false"]'
)
end
end
context
'when project has vulnerabilities'
do
before
do
create
(
:vulnerability
,
project:
project
)
end
it
'renders dashboard with vulnerability metadata'
do
show_security_dashboard
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
response
).
to
render_template
(
:index
)
expect
(
response
.
body
).
to
have_css
(
'div#js-security-report-app[data-has-vulnerabilities="true"]'
)
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