diff options
-rw-r--r-- | config/routes.rb | 1 | ||||
-rw-r--r-- | spec/integration/search_request_spec.rb | 7 |
2 files changed, 8 insertions, 0 deletions
diff --git a/config/routes.rb b/config/routes.rb index 747cc9b06..0ebd3dbc8 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -22,6 +22,7 @@ ActionController::Routing::Routes.draw do |map| general.blog '/blog', :action => 'blog' general.custom_css '/stylesheets/custom.css', :action => 'custom_css' general.search_redirect '/search', :action => 'search_redirect' + general.search_redirect '/search/all', :action => 'search_redirect' # XXX combined is the search query, and then if sorted a "/newest" at the end. # Couldn't find a way to do this in routes which also picked up multiple other slashes # and dots and other characters that can appear in search query. So we sort it all diff --git a/spec/integration/search_request_spec.rb b/spec/integration/search_request_spec.rb index b62f0a4c4..17a7b4aaa 100644 --- a/spec/integration/search_request_spec.rb +++ b/spec/integration/search_request_spec.rb @@ -12,6 +12,13 @@ describe "When searching" do response.body.should include(""mouse stilton"") end + it "should redirect requests with search in query string to URL-based page" do + url = '/search/all?query=bob' + request_via_redirect("post", url) + response.request.url.should_not include(url) + response.request.url.should include("/search/bob/all") + end + it "should correctly execute simple search" do request_via_redirect("post", "/search", :query => 'bob' |