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
f2030f1b
Commit
f2030f1b
authored
Jun 04, 2019
by
Avielle Wolfe
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add :type suffix to feedback type enum
parent
51fbdb3b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
5 deletions
+11
-5
ee/app/models/vulnerabilities/feedback.rb
ee/app/models/vulnerabilities/feedback.rb
+4
-4
ee/spec/models/vulnerabilities/feedback_spec.rb
ee/spec/models/vulnerabilities/feedback_spec.rb
+7
-1
No files found.
ee/app/models/vulnerabilities/feedback.rb
View file @
f2030f1b
...
...
@@ -14,15 +14,15 @@ module Vulnerabilities
attr_accessor
:vulnerability_data
enum
feedback_type:
{
dismissal:
0
,
issue:
1
,
merge_request:
2
}
enum
feedback_type:
{
dismissal:
0
,
issue:
1
,
merge_request:
2
}
,
_suffix: :type
enum
category:
{
sast:
0
,
dependency_scanning:
1
,
container_scanning:
2
,
dast:
3
}
validates
:project
,
presence:
true
validates
:author
,
presence:
true
validates
:comment_timestamp
,
:comment_author
,
presence:
true
,
if: :comment?
validates
:issue
,
presence:
true
,
if: :issue?
validates
:merge_request
,
presence:
true
,
if: :merge_request?
validates
:vulnerability_data
,
presence:
true
,
unless: :dismissal?
validates
:issue
,
presence:
true
,
if: :issue
_type
?
validates
:merge_request
,
presence:
true
,
if: :merge_request
_type
?
validates
:vulnerability_data
,
presence:
true
,
unless: :dismissal
_type
?
validates
:feedback_type
,
presence:
true
validates
:category
,
presence:
true
validates
:project_fingerprint
,
presence:
true
,
uniqueness:
{
scope:
[
:project_id
,
:category
,
:feedback_type
]
}
...
...
ee/spec/models/vulnerabilities/feedback_spec.rb
View file @
f2030f1b
...
...
@@ -3,7 +3,13 @@
require
'spec_helper'
describe
Vulnerabilities
::
Feedback
do
it
{
is_expected
.
to
define_enum_for
(
:feedback_type
)
}
it
{
is_expected
.
to
(
define_enum_for
(
:feedback_type
)
.
with_values
(
dismissal:
0
,
issue:
1
,
merge_request:
2
)
.
with_suffix
(
:type
)
)
}
it
{
is_expected
.
to
define_enum_for
(
:category
)
}
describe
'associations'
do
...
...
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