summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2015-05-04 08:53:21 +0000
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2015-05-04 08:53:21 +0000
commit16db51ec588bad1f341ffd3be9153cc453fce0f1 (patch)
tree07c792fce4ca269bfc0d35d8faf2bff404381b7e
parente9e79fdfdf7eee14efa9c5e8038b46538b6ac5e3 (diff)
parentd79348ab55c668883aa8d2a7fd5b59f28eb5118a (diff)
downloadgitlab-ce-16db51ec588bad1f341ffd3be9153cc453fce0f1.tar.gz
Merge branch 'fix-wiki-search' into 'master'
Fix Error 500 when searching Wiki pages If a Wiki page turns up a hit in the search results, an error will occur: ``` Completed 500 Internal Server Error in 836ms NoMethodError - undefined method `slug' for "test.markdown":String: app/helpers/wiki_helper.rb:10:in `namespace_project_wiki_path' app/views/search/results/_wiki_blob.html.haml:4:in `_app_views_search_results__wiki_blob_html_haml___2752621660395393333_70299911622700' actionview (4.1.9) lib/action_view/template.rb:145:in `block in render' activesupport (4.1.9) lib/active_support/notifications.rb:161:in `instrument' actionview (4.1.9) lib/action_view/template.rb:339:in `instrument' actionview (4.1.9) lib/action_view/template.rb:143:in `render' ``` An unhandled String containing the name of the Wiki page would be provided to the URL path generator. This MR handles that case. Closes #1547 See merge request !592
-rw-r--r--CHANGELOG1
-rw-r--r--app/helpers/wiki_helper.rb2
-rw-r--r--features/search.feature6
-rw-r--r--features/steps/project/wiki.rb5
-rw-r--r--features/steps/search.rb20
5 files changed, 34 insertions, 0 deletions
diff --git a/CHANGELOG b/CHANGELOG
index b9bd102ddf6..72ae0b4f24d 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -6,6 +6,7 @@ v 7.11.0 (unreleased)
- Don't allow a merge request to be merged when its title starts with "WIP".
- Add a page title to every page.
- Allow primary email to be set to an email that you've already added.
+ - Fix Error 500 when searching Wiki pages (Stan Hu)
- Get Gitorious importer to work again.
- Fix clone URL field and X11 Primary selection (Dmitry Medvinsky)
- Ignore invalid lines in .gitmodules
diff --git a/app/helpers/wiki_helper.rb b/app/helpers/wiki_helper.rb
index a3bc64c010e..f8a96516e61 100644
--- a/app/helpers/wiki_helper.rb
+++ b/app/helpers/wiki_helper.rb
@@ -6,6 +6,8 @@ module WikiHelper
case wiki_page
when Symbol
wiki_page
+ when String
+ wiki_page
else
wiki_page.slug
end
diff --git a/features/search.feature b/features/search.feature
index def21e00923..1608e824671 100644
--- a/features/search.feature
+++ b/features/search.feature
@@ -44,3 +44,9 @@ Feature: Search
Then I should see "Foo" link in the search results
And I should not see "Bar" link in the search results
+ Scenario: I should see Wiki blobs
+ And project has Wiki content
+ When I click project "Shop" link
+ And I search for "Wiki content"
+ And I click "Wiki" link
+ Then I should see "test_wiki" link in the search results
diff --git a/features/steps/project/wiki.rb b/features/steps/project/wiki.rb
index bb93e582a1f..717132da45d 100644
--- a/features/steps/project/wiki.rb
+++ b/features/steps/project/wiki.rb
@@ -159,6 +159,11 @@ class Spinach::Features::ProjectWiki < Spinach::FeatureSteps
page.should have_content('History for')
end
+ step 'I search for Wiki content' do
+ fill_in "Search in this project", with: "wiki_content"
+ click_button "Search"
+ end
+
def wiki
@project_wiki = ProjectWiki.new(project, current_user)
end
diff --git a/features/steps/search.rb b/features/steps/search.rb
index 6f0e038c4d6..8197cd410aa 100644
--- a/features/steps/search.rb
+++ b/features/steps/search.rb
@@ -18,6 +18,11 @@ class Spinach::Features::Search < Spinach::FeatureSteps
click_button "Search"
end
+ step 'I search for "Wiki content"' do
+ fill_in "dashboard_search", with: "content"
+ click_button "Search"
+ end
+
step 'I click "Issues" link' do
within '.search-filter' do
click_link 'Issues'
@@ -36,6 +41,12 @@ class Spinach::Features::Search < Spinach::FeatureSteps
end
end
+ step 'I click "Wiki" link' do
+ within '.search-filter' do
+ click_link 'Wiki'
+ end
+ end
+
step 'I should see "Shop" project link' do
page.should have_link "Shop"
end
@@ -66,4 +77,13 @@ class Spinach::Features::Search < Spinach::FeatureSteps
step 'I should not see "Bar" link in the search results' do
find(:css, '.search-results').should_not have_link 'Bar'
end
+
+ step 'I should see "test_wiki" link in the search results' do
+ find(:css, '.search-results').should have_link 'test_wiki.md'
+ end
+
+ step 'project has Wiki content' do
+ @wiki = ::ProjectWiki.new(project, current_user)
+ @wiki.create_page("test_wiki", "Some Wiki content", :markdown, "first commit")
+ end
end