Commit 19b7a490 authored by Sean Arnold's avatar Sean Arnold

Ignore blank searches

parent d6528bb4
......@@ -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)
......
......@@ -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
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment