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 @@
...
@@ -3,6 +3,8 @@
require
'spec_helper'
require
'spec_helper'
RSpec
.
describe
ProjectSecuritySetting
do
RSpec
.
describe
ProjectSecuritySetting
do
using
RSpec
::
Parameterized
::
TableSyntax
describe
'associations'
do
describe
'associations'
do
subject
{
create
(
:project
).
security_setting
}
subject
{
create
(
:project
).
security_setting
}
...
@@ -12,55 +14,29 @@ RSpec.describe ProjectSecuritySetting do
...
@@ -12,55 +14,29 @@ RSpec.describe ProjectSecuritySetting do
describe
'#auto_fix_enabled?'
do
describe
'#auto_fix_enabled?'
do
subject
{
setting
.
auto_fix_enabled?
}
subject
{
setting
.
auto_fix_enabled?
}
let_it_be
(
:setting
)
{
build
(
:project_security_setting
)
}
let
(
: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
context
'when a auto_fix setting is disabled for available features'
do
where
(
:license
,
:feature_flag
,
:auto_fix_container_scanning
,
:auto_fix_dependency_scanning
,
:auto_fix_sast
,
:auto_fix_enabled?
)
do
before
do
true
|
true
|
true
|
true
|
true
|
true
setting
.
auto_fix_container_scanning
=
false
false
|
true
|
true
|
true
|
true
|
false
setting
.
auto_fix_dependency_scanning
=
false
true
|
false
|
true
|
true
|
true
|
false
setting
.
auto_fix_sast
=
false
true
|
true
|
false
|
true
|
true
|
true
end
true
|
true
|
true
|
false
|
true
|
true
true
|
true
|
false
|
false
|
true
|
false
it
'marks auto_fix as disabled'
do
true
|
true
|
true
|
true
|
false
|
true
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
end
end
context
'when license feature is disabled'
do
with_them
do
before
do
before
do
stub_licensed_features
(
vulnerability_auto_fix:
fal
se
)
stub_licensed_features
(
vulnerability_auto_fix:
licen
se
)
end
stub_feature_flags
(
security_auto_fix:
feature_flag
)
it
'marks auto_fix as disabled'
do
setting
.
auto_fix_container_scanning
=
auto_fix_container_scanning
is_expected
.
to
be_falsey
setting
.
auto_fix_dependency_scanning
=
auto_fix_dependency_scanning
setting
.
auto_fix_sast
=
auto_fix_sast
end
end
it
{
is_expected
.
to
eq
(
auto_fix_enabled?
)
}
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