gitlab-org--gitlab-foss/spec/features/search_spec.rb
Rémy Coutable e60f034126
Fix view of notes in search results when noteable is a snippet
Also, streamline the view.

Signed-off-by: Rémy Coutable <remy@rymai.me>
2016-03-31 09:40:57 +02:00

46 lines
1.2 KiB
Ruby

require 'spec_helper'
describe "Search", feature: true do
let(:user) { create(:user) }
let(:project) { create(:project, namespace: user.namespace) }
before do
login_with(user)
project.team << [user, :reporter]
visit search_path
end
describe 'searching for Projects' do
it 'finds a project' do
page.within '.search-holder' do
fill_in "search", with: project.name[0..3]
click_button "Search"
end
expect(page).to have_content project.name
end
end
context 'search for comments' do
it 'finds a snippet' do
snippet = create(:project_snippet, :private, project: project, author: user, title: 'Some title')
note = create(:note,
noteable: snippet,
author: user,
note: 'Supercalifragilisticexpialidocious',
project: project)
# Must visit project dashboard since global search won't search
# everything (e.g. comments, snippets, etc.)
visit namespace_project_path(project.namespace, project)
page.within '.search' do
fill_in 'search', with: note.note
click_button 'Go'
end
click_link 'Comments'
expect(page).to have_link(snippet.title)
end
end
end