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
18615b6f
Commit
18615b6f
authored
Mar 01, 2021
by
Felipe Artur
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Validate last_test_report_state parameter
Validate last_test_report_state parameter used to filter requirements.
parent
0d347294
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
0 deletions
+16
-0
ee/app/finders/requirements_management/requirements_finder.rb
...pp/finders/requirements_management/requirements_finder.rb
+4
-0
ee/spec/finders/requirements_management/requirements_finder_spec.rb
...nders/requirements_management/requirements_finder_spec.rb
+12
-0
No files found.
ee/app/finders/requirements_management/requirements_finder.rb
View file @
18615b6f
...
...
@@ -4,10 +4,13 @@ module RequirementsManagement
class
RequirementsFinder
include
Gitlab
::
Utils
::
StrongMemoize
ALLOWED_LAST_TEST_REPORT_STATE_VALUES
=
TestReport
.
states
.
keys
.
push
(
"missing"
).
freeze
# Params:
# project_id: integer
# iids: integer[]
# state: string[]
# last_test_report_state: string
# sort: string
# search: string
# author_username: string
...
...
@@ -61,6 +64,7 @@ module RequirementsManagement
def
by_last_test_report_state
(
items
)
return
items
unless
params
[
:last_test_report_state
]
return
items
unless
ALLOWED_LAST_TEST_REPORT_STATE_VALUES
.
include?
(
params
[
:last_test_report_state
])
if
params
[
:last_test_report_state
]
==
'missing'
items
.
without_test_reports
...
...
ee/spec/finders/requirements_management/requirements_finder_spec.rb
View file @
18615b6f
...
...
@@ -62,6 +62,18 @@ RSpec.describe RequirementsManagement::RequirementsFinder do
is_expected
.
to
match_array
([
requirement1
,
requirement3
])
end
context
'when last_test_report_state is not valid'
do
let
(
:params
)
{
{
project_id:
project
.
id
,
last_test_report_state:
'not_valid'
}
}
it
'does not filter requirements'
do
is_expected
.
to
match_array
([
requirement1
,
requirement2
,
requirement3
])
end
it
'does not raise error'
do
expect
{
subject
}.
not_to
raise_error
end
end
end
context
'when user can not read requirements in the project'
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