diff options
author | Rémy Coutable <remy@rymai.me> | 2016-03-31 09:21:20 +0200 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2016-03-31 09:40:57 +0200 |
commit | e60f034126712b7e5a3b3ff9c5e92359aaf96e10 (patch) | |
tree | 5be2d71274cfc11e60e85222082c51d0f2cc2fb6 /spec/features | |
parent | 091b8a6ede2515bb555ec8662b9d933d70bda3e9 (diff) | |
download | gitlab-ce-e60f034126712b7e5a3b3ff9c5e92359aaf96e10.tar.gz |
Fix view of notes in search results when noteable is a snippetsnippets-with-comments-cause-a-500-when-they-show-up-in-search-results-14764
Also, streamline the view.
Signed-off-by: Rémy Coutable <remy@rymai.me>
Diffstat (limited to 'spec/features')
-rw-r--r-- | spec/features/search_spec.rb | 43 |
1 files changed, 35 insertions, 8 deletions
diff --git a/spec/features/search_spec.rb b/spec/features/search_spec.rb index 84c036e59c0..3e6289a46b1 100644 --- a/spec/features/search_spec.rb +++ b/spec/features/search_spec.rb @@ -1,19 +1,46 @@ require 'spec_helper' describe "Search", feature: true do + let(:user) { create(:user) } + let(:project) { create(:project, namespace: user.namespace) } + before do - login_as :user - @project = create(:project, namespace: @user.namespace) - @project.team << [@user, :reporter] + login_with(user) + project.team << [user, :reporter] visit search_path + end - page.within '.search-holder' do - fill_in "search", with: @project.name[0..3] - click_button "Search" + 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 - it "should show project in search results" do - expect(page).to have_content @project.name + 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 |