diff options
author | David Cabo <david@calibea.com> | 2011-09-23 02:50:41 +0200 |
---|---|---|
committer | David Cabo <david@calibea.com> | 2011-09-23 02:50:41 +0200 |
commit | b48df57d9243336d4b96e29c5587137eff3a3c67 (patch) | |
tree | 305d04ef9712e0af35fd346068164507c600423d /spec/controllers/request_controller_spec.rb | |
parent | 7ee0ae2e506d1b50132264744da3f46b346998e1 (diff) |
Remove invalid collate argument for public body searches
The existing bug wasn't catched by the tests, because it only fails when running in dev: otherwise all the classes are loaded before the search is done, and acts_as_xapian can find the provided 'request_collapse' argument, even if the PublicBody class doesn't define it, since all the init options end up together in acts_as_xapian.
Diffstat (limited to 'spec/controllers/request_controller_spec.rb')
-rw-r--r-- | spec/controllers/request_controller_spec.rb | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/spec/controllers/request_controller_spec.rb b/spec/controllers/request_controller_spec.rb index aa3027c00..494713a4a 100644 --- a/spec/controllers/request_controller_spec.rb +++ b/spec/controllers/request_controller_spec.rb @@ -329,6 +329,33 @@ end # response.headers["Status"].should == "404 Not Found" # end +describe RequestController, "when searching for an authority" do + fixtures :public_bodies, :users + + # Whether or not sign-in is required for this step is configurable, + # so we make sure we're logged in, just in case + before do + @user = users(:bob_smith_user) + end + + it "should return nothing for the empty query string" do + session[:user_id] = @user.id + get :select_authority, :query => "" + + response.should render_template('select_authority') + assigns[:xapian_requests].results.size == 0 + end + + it "should return matching bodies" do + session[:user_id] = @user.id + get :select_authority, :query => "Quango" + + response.should render_template('select_authority') + assigns[:xapian_requests].results.size == 1 + assigns[:xapian_requests].results[0][:model].name.should == public_bodies(:geraldine_public_body).name + end +end + describe RequestController, "when creating a new request" do integrate_views fixtures :info_requests, :outgoing_messages, :public_bodies, :public_body_translations, :users |