blob: 0139ac268165f3475e58aa7ed03cad0f7ff9a634 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
# frozen_string_literal: true
require 'spec_helper'
describe 'User searches for merge requests', :js do
let(:user) { create(:user) }
let(:project) { create(:project, namespace: user.namespace) }
let!(:merge_request1) { create(:merge_request, title: 'Foo', source_project: project, target_project: project) }
let!(:merge_request2) { create(:merge_request, :simple, title: 'Bar', source_project: project, target_project: project) }
before do
project.add_maintainer(user)
sign_in(user)
visit(search_path)
end
include_examples 'top right search form'
it 'finds a merge request' do
fill_in('dashboard_search', with: merge_request1.title)
find('.btn-search').click
select_search_scope('Merge requests')
page.within('.results') do
expect(page).to have_link(merge_request1.title)
expect(page).not_to have_link(merge_request2.title)
end
end
context 'when on a project page' do
it 'finds a merge request' do
find('.js-search-project-dropdown').click
page.within('.project-filter') do
click_link(project.full_name)
end
fill_in('dashboard_search', with: merge_request1.title)
find('.btn-search').click
select_search_scope('Merge requests')
page.within('.results') do
expect(page).to have_link(merge_request1.title)
expect(page).not_to have_link(merge_request2.title)
end
end
end
end
|