diff options
author | francis <francis> | 2008-05-15 22:18:19 +0000 |
---|---|---|
committer | francis <francis> | 2008-05-15 22:18:19 +0000 |
commit | eb04710bf6c54a7ae78978cceef278a48ceea268 (patch) | |
tree | c6029e2eaf37a005e4ea4c491031bc1f80ffb7c2 /spec/controllers/general_controller_spec.rb | |
parent | 9f7e49290896e325060798e86a84602f92e99396 (diff) |
Test code for search separated by type.
Diffstat (limited to 'spec/controllers/general_controller_spec.rb')
-rw-r--r-- | spec/controllers/general_controller_spec.rb | 34 |
1 files changed, 12 insertions, 22 deletions
diff --git a/spec/controllers/general_controller_spec.rb b/spec/controllers/general_controller_spec.rb index 276b46aac..abc63c290 100644 --- a/spec/controllers/general_controller_spec.rb +++ b/spec/controllers/general_controller_spec.rb @@ -42,41 +42,31 @@ describe GeneralController, "when searching" do get :search, :combined => ['"fancy dog"'] response.should render_template('search') - assigns[:search_hits].should == 1 - assigns[:search_results].size.should == 1 - assigns[:search_results][0][:model].should == info_request_events(:useless_outgoing_message_event) + assigns[:xapian_requests].matches_estimated.should == 1 + assigns[:xapian_requests].results.size.should == 1 + assigns[:xapian_requests].results[0][:model].should == info_request_events(:useless_outgoing_message_event) - assigns[:highlight_words].should == ["fancy", "dog"] + assigns[:xapian_requests].words_to_highlight == ["fancy", "dog"] end it "should show help when searching for nothing" do get :search_redirect, :query => nil response.should render_template('search') - assigns[:search_hits].should be_nil + assigns[:total_hits].should be_nil assigns[:query].should be_nil end - it "should find public body and incoming message (in that order) when searching for 'geraldine quango'" do + it "should find public body and incoming message when searching for 'geraldine quango'" do get :search, :combined => ['geraldine quango'] response.should render_template('search') - assigns[:search_hits].should == 2 - assigns[:search_results].size.should == 2 - assigns[:search_results][0][:model].should == public_bodies(:geraldine_public_body) - assigns[:search_results][1][:model].should == info_request_events(:useless_incoming_message_event) - end - - it "should find incoming message and public body (in that order) when searching for 'geraldine quango', newest first" do - get :search, :combined => ['geraldine quango','newest'] - response.should render_template('search') + assigns[:xapian_requests].matches_estimated.should == 1 + assigns[:xapian_requests].results.size.should == 1 + assigns[:xapian_requests].results[0][:model].should == info_request_events(:useless_incoming_message_event) - assigns[:search_hits].should == 2 - assigns[:search_results].size.should == 2 - assigns[:search_results][0][:model].should == info_request_events(:useless_incoming_message_event) - assigns[:search_results][1][:model].should == public_bodies(:geraldine_public_body) + assigns[:xapian_bodies].matches_estimated.should == 1 + assigns[:xapian_bodies].results.size.should == 1 + assigns[:xapian_bodies].results[0][:model].should == public_bodies(:geraldine_public_body) end - - - # assigns[:display_user].should == users(:bob_smith_user) end |