mirror of
https://github.com/wahyd4/gitlabhq.git
synced 2026-08-27 13:36:06 +10:00
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
90 lines
2.3 KiB
Ruby
90 lines
2.3 KiB
Ruby
class Spinach::Features::Search < Spinach::FeatureSteps
|
|
include SharedAuthentication
|
|
include SharedPaths
|
|
include SharedProject
|
|
|
|
step 'I search for "Sho"' do
|
|
fill_in "dashboard_search", with: "Sho"
|
|
click_button "Search"
|
|
end
|
|
|
|
step 'I search for "Foo"' do
|
|
fill_in "dashboard_search", with: "Foo"
|
|
click_button "Search"
|
|
end
|
|
|
|
step 'I search for "rspec"' do
|
|
fill_in "dashboard_search", with: "rspec"
|
|
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'
|
|
end
|
|
end
|
|
|
|
step 'I click project "Shop" link' do
|
|
within '.project-filter' do
|
|
click_link project.name_with_namespace
|
|
end
|
|
end
|
|
|
|
step 'I click "Merge requests" link' do
|
|
within '.search-filter' do
|
|
click_link 'Merge requests'
|
|
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
|
|
|
|
step 'I should see code results for project "Shop"' do
|
|
page.should have_content 'Update capybara, rspec-rails, poltergeist to recent versions'
|
|
end
|
|
|
|
step 'I search for "Contibuting"' do
|
|
fill_in "dashboard_search", with: "Contibuting"
|
|
click_button "Search"
|
|
end
|
|
|
|
step 'project has issues' do
|
|
create(:issue, title: "Foo", project: project)
|
|
create(:issue, title: "Bar", project: project)
|
|
end
|
|
|
|
step 'project has merge requests' do
|
|
create(:merge_request, title: "Foo", source_project: project, target_project: project)
|
|
create(:merge_request, :simple, title: "Bar", source_project: project, target_project: project)
|
|
end
|
|
|
|
step 'I should see "Foo" link in the search results' do
|
|
find(:css, '.search-results').should have_link 'Foo'
|
|
end
|
|
|
|
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
|