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
1b52f3b6
Commit
1b52f3b6
authored
Dec 22, 2020
by
Tetiana Chupryna
Committed by
Stan Hu
Dec 23, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rework tests in table style
parent
fe0d76d1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
43 deletions
+19
-43
ee/spec/models/project_security_setting_spec.rb
ee/spec/models/project_security_setting_spec.rb
+19
-43
No files found.
ee/spec/models/project_security_setting_spec.rb
View file @
1b52f3b6
...
...
@@ -3,6 +3,8 @@
require
'spec_helper'
RSpec
.
describe
ProjectSecuritySetting
do
using
RSpec
::
Parameterized
::
TableSyntax
describe
'associations'
do
subject
{
create
(
:project
).
security_setting
}
...
...
@@ -12,55 +14,29 @@ RSpec.describe ProjectSecuritySetting do
describe
'#auto_fix_enabled?'
do
subject
{
setting
.
auto_fix_enabled?
}
let_it_be
(
:setting
)
{
build
(
:project_security_setting
)
}
context
'when licensed feature is enabled'
do
before
do
stub_licensed_features
(
vulnerability_auto_fix:
true
)
end
context
'when auto fix is enabled for available feature'
do
before
do
setting
.
auto_fix_container_scanning
=
false
setting
.
auto_fix_dependency_scanning
=
true
end
it
'marks auto_fix as enabled'
do
is_expected
.
to
be_truthy
end
end
let
(
:setting
)
{
build
(
:project_security_setting
)
}
context
'when a auto_fix setting is disabled for available features'
do
before
do
setting
.
auto_fix_container_scanning
=
false
setting
.
auto_fix_dependency_scanning
=
false
setting
.
auto_fix_sast
=
false
end
it
'marks auto_fix as disabled'
do
is_expected
.
to
be_falsey
end
end
context
'when feature is disabled'
do
before
do
stub_feature_flags
(
security_auto_fix:
false
)
end
it
'marks auto_fix as disabled'
do
is_expected
.
to
be_falsey
end
end
where
(
:license
,
:feature_flag
,
:auto_fix_container_scanning
,
:auto_fix_dependency_scanning
,
:auto_fix_sast
,
:auto_fix_enabled?
)
do
true
|
true
|
true
|
true
|
true
|
true
false
|
true
|
true
|
true
|
true
|
false
true
|
false
|
true
|
true
|
true
|
false
true
|
true
|
false
|
true
|
true
|
true
true
|
true
|
true
|
false
|
true
|
true
true
|
true
|
false
|
false
|
true
|
false
true
|
true
|
true
|
true
|
false
|
true
end
context
'when license feature is disabled'
do
with_them
do
before
do
stub_licensed_features
(
vulnerability_auto_fix:
fal
se
)
end
stub_licensed_features
(
vulnerability_auto_fix:
licen
se
)
stub_feature_flags
(
security_auto_fix:
feature_flag
)
it
'marks auto_fix as disabled'
do
is_expected
.
to
be_falsey
setting
.
auto_fix_container_scanning
=
auto_fix_container_scanning
setting
.
auto_fix_dependency_scanning
=
auto_fix_dependency_scanning
setting
.
auto_fix_sast
=
auto_fix_sast
end
it
{
is_expected
.
to
eq
(
auto_fix_enabled?
)
}
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