From 33bd0e919528e1d7eda4be4200db91b042984c97 Mon Sep 17 00:00:00 2001 From: Seb Bacon Date: Fri, 26 Aug 2011 13:54:05 +0100 Subject: Fixes to get tests to pass following addition of new search / filter functionality --- spec/controllers/general_controller_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'spec/controllers/general_controller_spec.rb') diff --git a/spec/controllers/general_controller_spec.rb b/spec/controllers/general_controller_spec.rb index 3640a8148..a76cdd3b6 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") # URL /search/:query + response.should redirect_to(:action => 'search', :combined => "mouse", :view => "all") # URL /search/:query/all end describe "when using different locale settings" do -- cgit v1.2.3 From b41edc7ae069e6071f7ff7223c1e60cca5e75e8c Mon Sep 17 00:00:00 2001 From: Seb Bacon Date: Mon, 29 Aug 2011 13:13:59 +0100 Subject: Add tests & fixes for new search/filtering functionality --- spec/controllers/general_controller_spec.rb | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'spec/controllers/general_controller_spec.rb') diff --git a/spec/controllers/general_controller_spec.rb b/spec/controllers/general_controller_spec.rb index a76cdd3b6..4d7f1831d 100644 --- a/spec/controllers/general_controller_spec.rb +++ b/spec/controllers/general_controller_spec.rb @@ -122,6 +122,34 @@ describe GeneralController, "when searching" do end + it "should filter results based on end of URL being 'all'" do + get :search, :combined => ['"bob"', "all"] + assigns[:xapian_requests].results.size.should == 2 + assigns[:xapian_users].results.size.should == 1 + assigns[:xapian_bodies].results.size.should == 0 + end + + it "should filter results based on end of URL being 'users'" do + get :search, :combined => ['"bob"', "users"] + assigns[:xapian_requests].should == nil + assigns[:xapian_users].results.size.should == 1 + assigns[:xapian_bodies].should == nil + end + + it "should filter results based on end of URL being 'requests'" do + get :search, :combined => ['"bob"', "requests"] + assigns[:xapian_requests].results.size.should == 2 + assigns[:xapian_users].should == nil + assigns[:xapian_bodies].should == nil + end + + it "should filter results based on end of URL being 'bodies'" do + get :search, :combined => ['"quango"', "bodies"] + assigns[:xapian_requests].should == nil + assigns[:xapian_users].should == nil + assigns[:xapian_bodies].results.size.should == 1 + end + it "should show help when searching for nothing" do get :search_redirect, :query => nil response.should render_template('search') -- cgit v1.2.3 From 21495a7361c275040d22bb88a70186253d20853a Mon Sep 17 00:00:00 2001 From: Seb Bacon Date: Thu, 1 Sep 2011 13:45:18 +0100 Subject: Make the general search return requests only, by default --- spec/controllers/general_controller_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'spec/controllers/general_controller_spec.rb') 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 -- cgit v1.2.3