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
19b7a490
Commit
19b7a490
authored
May 18, 2020
by
Sean Arnold
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Ignore blank searches
parent
d6528bb4
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
2 deletions
+13
-2
app/finders/alert_management/alerts_finder.rb
app/finders/alert_management/alerts_finder.rb
+1
-1
spec/finders/alert_management/alerts_finder_spec.rb
spec/finders/alert_management/alerts_finder_spec.rb
+12
-1
No files found.
app/finders/alert_management/alerts_finder.rb
View file @
19b7a490
...
...
@@ -35,7 +35,7 @@ module AlertManagement
end
def
by_search
(
collection
)
params
[
:search
]
?
collection
.
search
(
params
[
:search
])
:
collection
params
[
:search
]
.
present?
?
collection
.
search
(
params
[
:search
])
:
collection
end
def
sort
(
collection
)
...
...
spec/finders/alert_management/alerts_finder_spec.rb
View file @
19b7a490
...
...
@@ -227,7 +227,6 @@ describe AlertManagement::AlertsFinder, '#execute' do
let_it_be
(
:alert
)
do
create
(
:alert_management_alert
,
:with_fingerprint
,
project:
project
,
title:
'Title'
,
description:
'Desc'
,
service:
'Service'
,
...
...
@@ -235,6 +234,12 @@ describe AlertManagement::AlertsFinder, '#execute' do
)
end
before
do
alert
.
project
.
add_developer
(
current_user
)
end
subject
{
described_class
.
new
(
current_user
,
alert
.
project
,
params
).
execute
}
context
'searching title'
do
let
(
:params
)
{
{
search:
alert
.
title
}
}
...
...
@@ -264,6 +269,12 @@ describe AlertManagement::AlertsFinder, '#execute' do
it
{
is_expected
.
to
be_empty
}
end
context
'empty search'
do
let
(
:params
)
{
{
search:
' '
}
}
it
{
is_expected
.
to
match_array
([
alert
])
}
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