From: Jean-Philippe Lang Date: Sun, 8 Apr 2012 21:01:20 +0000 (+0000) Subject: Merged r9371 from trunk. X-Git-Tag: 1.4.0~20 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=c229ea63868ea27d6e94d8e74d6b4b10303157a8;p=redmine.git Merged r9371 from trunk. git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/1.4-stable@9373 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- diff --git a/config/routes.rb b/config/routes.rb index 5cba46c00..51bb66cca 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -339,6 +339,7 @@ ActionController::Routing::Routes.draw do |map| map.resources :roles, :except => :show, :collection => {:permissions => [:get, :post]} map.resources :enumerations, :except => :show + map.connect 'projects/:id/search', :controller => 'search', :action => 'index', :conditions => {:method => :get} map.connect 'search', :controller => 'search', :action => 'index', :conditions => {:method => :get} map.connect 'mail_handler', :controller => 'mail_handler', diff --git a/test/integration/layout_test.rb b/test/integration/layout_test.rb index 853bfea4a..682b9bee5 100644 --- a/test/integration/layout_test.rb +++ b/test/integration/layout_test.rb @@ -53,4 +53,14 @@ class LayoutTest < ActionController::IntegrationTest :attributes => {:src => %r{^/javascripts/jstoolbar/textile.js}}, :parent => {:tag => 'head'} end + + def test_search_field_outside_project_should_link_to_global_search + get '/' + assert_select 'div#quick-search form[action=/search]' + end + + def test_search_field_inside_project_should_link_to_project_search + get '/projects/ecookbook' + assert_select 'div#quick-search form[action=/projects/ecookbook/search]' + end end diff --git a/test/integration/routing/search_test.rb b/test/integration/routing/search_test.rb index 23c1271eb..f5b24ce35 100644 --- a/test/integration/routing/search_test.rb +++ b/test/integration/routing/search_test.rb @@ -23,5 +23,9 @@ class RoutingSearchTest < ActionController::IntegrationTest { :method => 'get', :path => "/search" }, { :controller => 'search', :action => 'index' } ) + assert_routing( + { :method => 'get', :path => "/projects/foo/search" }, + { :controller => 'search', :action => 'index', :id => 'foo' } + ) end end