From 9f1fe3ca49298c5ea52cd6ebb7c2e518d45e7718 Mon Sep 17 00:00:00 2001 From: Seb Bacon Date: Wed, 21 Dec 2011 13:33:18 +0000 Subject: Don't do wildcard searches for partial matches in type ahead searches. Fixes #310. --- spec/controllers/public_body_controller_spec.rb | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'spec/controllers/public_body_controller_spec.rb') diff --git a/spec/controllers/public_body_controller_spec.rb b/spec/controllers/public_body_controller_spec.rb index d47ea7b8d..8182e1331 100644 --- a/spec/controllers/public_body_controller_spec.rb +++ b/spec/controllers/public_body_controller_spec.rb @@ -177,7 +177,7 @@ describe PublicBodyController, "when doing type ahead searches" do it "should return nothing for the empty query string" do get :search_typeahead, :q => "" response.should render_template('public_body/_search_ahead') - assigns[:xapian_requests].results.size.should == 0 + assigns[:xapian_requests].should be_nil end it "should return a body matching the given keyword, but not users with a matching description" do @@ -202,10 +202,9 @@ describe PublicBodyController, "when doing type ahead searches" do assigns[:xapian_requests].results[0][:model].name.should == public_bodies(:humpadink_public_body).name end - it "should return partial matches" do - get :search_typeahead, :q => "geral" # 'geral' for 'Geraldine' + it "should not return matches for short words" do + get :search_typeahead, :q => "b" response.should render_template('public_body/_search_ahead') - assigns[:xapian_requests].results.size.should == 1 - assigns[:xapian_requests].results[0][:model].name.should == public_bodies(:geraldine_public_body).name + assigns[:xapian_requests].should be_nil end end -- cgit v1.2.3