aboutsummaryrefslogtreecommitdiffstats
path: root/spec/controllers/general_controller_spec.rb
diff options
context:
space:
mode:
authorSeb Bacon <seb.bacon@gmail.com>2011-08-29 13:13:59 +0100
committerSeb Bacon <seb.bacon@gmail.com>2011-08-29 13:13:59 +0100
commitb41edc7ae069e6071f7ff7223c1e60cca5e75e8c (patch)
treef2d7a1d218465247843036ccf8153fd8994afd30 /spec/controllers/general_controller_spec.rb
parenteef876ff7ce15f1a15e6760a1f251c98d383cf4e (diff)
Add tests & fixes for new search/filtering functionality
Diffstat (limited to 'spec/controllers/general_controller_spec.rb')
-rw-r--r--spec/controllers/general_controller_spec.rb28
1 files changed, 28 insertions, 0 deletions
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')