From 22eb2e4c227b060981bb37708222cdd07e825542 Mon Sep 17 00:00:00 2001 From: Jacopo Date: Thu, 17 Jan 2019 15:35:23 +0100 Subject: Adds milestone search Adds to search ILIKE search for milestones title in: - Milestones dashboard - Group milestones page - Project milestones page --- .../groups/milestones_controller_spec.rb | 31 +++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) (limited to 'spec/controllers/groups') diff --git a/spec/controllers/groups/milestones_controller_spec.rb b/spec/controllers/groups/milestones_controller_spec.rb index 40d991a669c..043cf28514b 100644 --- a/spec/controllers/groups/milestones_controller_spec.rb +++ b/spec/controllers/groups/milestones_controller_spec.rb @@ -32,10 +32,35 @@ describe Groups::MilestonesController do end describe '#index' do - it 'shows group milestones page' do - get :index, params: { group_id: group.to_param } + describe 'as HTML' do + render_views - expect(response).to have_gitlab_http_status(200) + it 'shows group milestones page' do + milestone + + get :index, params: { group_id: group.to_param } + + expect(response).to have_gitlab_http_status(200) + expect(response.body).to include(milestone.title) + end + + it 'searches legacy milestones by title when search_title is given' do + project_milestone = create(:milestone, project: project, title: 'Project milestone title') + + get :index, params: { group_id: group.to_param, search_title: 'Project mil' } + + expect(response.body).to include(project_milestone.title) + expect(response.body).not_to include(milestone.title) + end + + it 'searches group milestones by title when search_title is given' do + group_milestone = create(:milestone, title: 'Group milestone title', group: group) + + get :index, params: { group_id: group.to_param, search_title: 'Group mil' } + + expect(response.body).to include(group_milestone.title) + expect(response.body).not_to include(milestone.title) + end end context 'as JSON' do -- cgit v1.2.1