]> git.openstreetmap.org Git - rails.git/commitdiff
Redirect /?query= to /search?query=
authorTom Hughes <tom@compton.nu>
Sat, 30 Nov 2013 12:36:47 +0000 (12:36 +0000)
committerTom Hughes <tom@compton.nu>
Sat, 30 Nov 2013 12:38:44 +0000 (12:38 +0000)
app/controllers/site_controller.rb
test/integration/redirect_test.rb

index 1757e771a9fc085a5c85c8b8c7906d5ebdf56aad..5c391d7b228359ca6041f8c26d9b5f86c9dc35bb 100644 (file)
@@ -97,6 +97,8 @@ class SiteController < ApplicationController
       redirect_to relation_path(params[:relation])
     elsif params[:note]
       redirect_to browse_note_path(params[:note])
+    elsif params[:query]
+      redirect_to search_path(:query => params[:query])
     end
   end
 
index 42199ce4e63e79c443c21b7361bdf2b927eb1b8e..db28032f15a2d467e701bddaec67a007d8c21ad3 100644 (file)
@@ -1,6 +1,12 @@
 require File.dirname(__FILE__) + '/../test_helper'
 
 class RedirectTest  < ActionDispatch::IntegrationTest
+  def test_search_redirects
+    get "/?query=test"
+    assert_response :redirect
+    assert_redirected_to "/search?query=test"
+  end
+
   def test_history_redirects
     get "/browse"
     assert_response :redirect