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 1757e77..5c391d7 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 42199ce..db28032 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