diff options
author | Stan Hu <stanhu@gmail.com> | 2019-04-25 22:18:49 +0000 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2019-04-25 22:18:49 +0000 |
commit | f04f6909cebac79704081bc4787099c613a70cf7 (patch) | |
tree | 4cbf437e1f1c8edb5438c1676a348d858b3fdb3d /spec/controllers | |
parent | 34578f8accc9518ae4fd0c006243cee733f9407c (diff) | |
parent | d60d50d6baa285d869ab1318c70a3baf0bab2701 (diff) | |
download | gitlab-ce-f04f6909cebac79704081bc4787099c613a70cf7.tar.gz |
Merge branch '60906-fix-wiki-links' into 'master'
Use wiki partial in search results
Closes #60906
See merge request gitlab-org/gitlab-ce!27634
Diffstat (limited to 'spec/controllers')
-rw-r--r-- | spec/controllers/search_controller_spec.rb | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/spec/controllers/search_controller_spec.rb b/spec/controllers/search_controller_spec.rb index 9c60f0fcd4d..4634d1d4bb3 100644 --- a/spec/controllers/search_controller_spec.rb +++ b/spec/controllers/search_controller_spec.rb @@ -11,6 +11,30 @@ describe SearchController do sign_in(user) end + context 'uses the right partials depending on scope' do + using RSpec::Parameterized::TableSyntax + render_views + + set(:project) { create(:project, :public, :repository, :wiki_repo) } + + subject { get(:show, params: { project_id: project.id, scope: scope, search: 'merge' }) } + + where(:partial, :scope) do + '_blob' | :blobs + '_wiki_blob' | :wiki_blobs + '_commit' | :commits + end + + with_them do + it do + project_wiki = create(:project_wiki, project: project, user: user) + create(:wiki_page, wiki: project_wiki, attrs: { title: 'merge', content: 'merge' }) + + expect(subject).to render_template("search/results/#{partial}") + end + end + end + it 'finds issue comments' do project = create(:project, :public) note = create(:note_on_issue, project: project) |