aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--app/controllers/general_controller.rb2
-rw-r--r--app/views/general/search.rhtml4
-rw-r--r--config/routes.rb2
-rw-r--r--spec/controllers/general_controller_spec.rb2
-rw-r--r--spec/integration/search_request_spec.rb9
5 files changed, 12 insertions, 7 deletions
diff --git a/app/controllers/general_controller.rb b/app/controllers/general_controller.rb
index 004136163..73c8407fd 100644
--- a/app/controllers/general_controller.rb
+++ b/app/controllers/general_controller.rb
@@ -99,7 +99,7 @@ class GeneralController < ApplicationController
@variety_postfix = path.pop
end
@variety_postfix = params[:bodies] if @variety_postfix.nil? && !params[:bodies].nil?
- @variety_postfix = "all" if @variety_postfix.nil?
+ @variety_postfix = "requests" if @variety_postfix.nil?
if @variety_postfix != "users"
@common_query = get_tags_from_params
end
diff --git a/app/views/general/search.rhtml b/app/views/general/search.rhtml
index fe6a49393..f16661b13 100644
--- a/app/views/general/search.rhtml
+++ b/app/views/general/search.rhtml
@@ -46,10 +46,10 @@
<div id="variety-filter">
<h3 class="title"><%= _("Showing") %></h3>
<% labels = [
- ["all", _("everything")],
["requests", _("requests")],
["users", _("users")],
- ["bodies", _("authorities")]]%>
+ ["bodies", _("authorities")],
+ ["all", _("everything")]]%>
<% for variety, label in labels %>
<% if @variety_postfix != variety %>
<% if variety != "users" %>
diff --git a/config/routes.rb b/config/routes.rb
index c067de4e5..c1bbfc3b3 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -23,7 +23,7 @@ ActionController::Routing::Routes.draw do |map|
# 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
# out in the controller.
- general.search_general '/search/*combined/all', :action => 'search', :view => 'all'
+ general.search_general '/search/*combined/requests', :action => 'search', :view => 'requests'
general.search_general '/search/*combined', :action => 'search'
general.advanced_search '/advancedsearch', :action => 'search_redirect', :advanced => true
diff --git a/spec/controllers/general_controller_spec.rb b/spec/controllers/general_controller_spec.rb
index 4d7f1831d..1ffbda90d 100644
--- a/spec/controllers/general_controller_spec.rb
+++ b/spec/controllers/general_controller_spec.rb
@@ -64,7 +64,7 @@ describe GeneralController, "when searching" do
it "should redirect from search query URL to pretty URL" do
post :search_redirect, :query => "mouse" # query hidden in POST parameters
- response.should redirect_to(:action => 'search', :combined => "mouse", :view => "all") # URL /search/:query/all
+ response.should redirect_to(:action => 'search', :combined => "mouse", :view => "requests") # URL /search/:query/all
end
describe "when using different locale settings" do
diff --git a/spec/integration/search_request_spec.rb b/spec/integration/search_request_spec.rb
index 8e714eb27..25c091111 100644
--- a/spec/integration/search_request_spec.rb
+++ b/spec/integration/search_request_spec.rb
@@ -25,14 +25,19 @@ describe "When searching" do
request_via_redirect("post", "/search",
:query => 'bob'
)
- response.body.should include("One person found")
+ response.body.should include("FOI requests")
end
it "should correctly filter searches for requests" do
request_via_redirect("post", "/search/bob/requests")
- response.body.should_not include("One person matching")
+ response.body.should_not include("One person found")
response.body.should include("FOI requests 1 to 2 of 2")
end
+ it "should correctly filter searches for users" do
+ request_via_redirect("post", "/search/bob/users")
+ response.body.should include("One person found")
+ response.body.should_not include("FOI requests 1 to 2 of 2")
+ end
it "should correctly filter searches for successful requests" do
request_via_redirect("post", "/search",